java


Configuration for creating multiple instances of hazelcast in a single JVM


I need to create two instances of hazelcast in a single tomcat server. I've integrated hazelcast with spring. Below are the configuration files.
hazelcast.properties
#First instance properties
hz.instance.name = mi
hz.group.name = mi
hz.group.password = password
hz.management.center.enabled = true
hz.management.center.url = http://localhost:8085/mancenter
hz.network.port = 5701
hz.network.port.auto.increment = true
hz.tcp.ip.enabled = false
hz.members = 127.0.0.1
hz.multicast = true
hz.multicast.group = 224.2.2.3
hz.multicast.port= 54327
hz.multicast.timetolive=32
hz.multicast.timeout.seconds=2
#Second instance properties
hz.instance.nameOne = miOne
hz.group.name = mi
hz.group.password = password
hz.management.center.enabled = true
hz.management.center.url = http://localhost:8085/mancenter
hz.network.port = 5701
hz.network.port.auto.increment = true
hz.tcp.ip.enabled = false
hz.members = 127.0.0.1
hz.multicast = true
hz.multicast.group = 224.2.2.3
hz.multicast.port= 54327
hz.multicast.timetolive=32
hz.multicast.timeout.seconds=2
hazelcast.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:hz="http://www.hazelcast.com/schema/spring"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.hazelcast.com/schema/spring http://www.hazelcast.com/schema/spring/hazelcast-spring.xsd">
<hz:hazelcast id="instance">
<hz:config>
<hz:instance-name>${hz.instance.name}</hz:instance-name>
<hz:group name="${hz.group.name}" password="${hz.group.password}" />
<hz:management-center enabled="${hz.management.center.enabled}"
url="${hz.management.center.url}" />
<hz:network port="${hz.network.port}" port-auto-increment="${hz.network.port.auto.increment}">
<hz:join>
<hz:multicast enabled="${hz.multicast}" />
<hz:tcp-ip enabled="${hz.tcp.ip.enabled}">
<hz:members>${hz.members}</hz:members>
</hz:tcp-ip>
</hz:join>
</hz:network>
</hz:config>
</hz:hazelcast>
<hz:hazelcast id="instanceOne">
<hz:config>
<hz:instance-name>${hz.instance.nameOne}</hz:instance-name>
<hz:group name="${hz.group.name}" password="${hz.group.password}" />
<hz:management-center enabled="${hz.management.center.enabled}"
url="${hz.management.center.url}" />
<hz:network port="${hz.network.port}" port-auto-increment="${hz.network.port.auto.increment}">
<hz:join>
<hz:multicast enabled="${hz.multicast}" />
<hz:tcp-ip enabled="${hz.tcp.ip.enabled}">
<hz:members>${hz.members}</hz:members>
</hz:tcp-ip>
</hz:join>
</hz:network>
</hz:config>
</hz:hazelcast>
<hz:map id="map" instance-ref="instance" name="Map" />
</beans>
In hazelcast.xml if you can see I've registered two instances of hazelcast
instance & instanceOne. instanceOne is almost the copy config. of instance If I remove instanceOne the second member/instance doesn't start. Say I have to create n instances of hazelcast in a single JVM. Do I have register the instance n times in hazelcast.xml or is there any better way to configure the beans?.

Related Links

EditText caches old text
using java to call python in eclipse path issue
Log4j 2 logs are being written in Log4j log file
Overriding equals()
Cannot get scrollbar to show
jersey rest api executed two times
why TimeUnit.convert() dont convert correctly in Java?
Java writeBytes white space replaced by '+'
Java most specific method subtyping rules
How does one know what IDE was used for an open-source Java application?
Setting up JNDI with a Tomcat 7 environment using Liferay 6.1
SLF4J Logger binding not working
How i fill a Spinner with a ArrayList through a ArrayAdapter?
Access springbeans in JerseyTest with Jersey2.0
ClassNotFoundException: org.apache.poi.xwpf.converter.core.Options Module deployment.ear
How do I convert a libGDX GWT game to version 1.9.5?

Categories

HOME
pandas
date
asp.net-core
reflection
relative-path
read-eval-print-loop
razor
spring-jdbc
c#-2.0
blueprintjs
fancybox
uber-api
jsdoc
lucene.net
textfield
emulator
riot.js
scriptcs
jquery-ajaxq
pass-by-reference
icloud-api
linkerd
strncpy
assistant
nat
google-qpx-express-api
column-family
framemaker
vsts-build-task
hybridauth
avcapturesession
atl
normal-distribution
mapdb
jmonkeyengine
multilingual
preconditions
ruby-on-rails-3.1
botbuilder
slick-3.0
convertapi
osx-mavericks
revapi
jquery-nestable
togetherjs
carrot
csound
composite-key
namecoin
knpmenubundle
mcafee
bind9
dwscript
infix-notation
python-stackless
bluemix-app-scan
rhino-servicebus
revolution-r
itextpdf
wapiti
maven-tomcat-plugin
ora-00900
tmuxinator
embedded-code
drawbitmap
geonetwork
google-style-guide
winddk
fpml
jubula
system.net.webexception
resty-gwt
viadeo
flexmojos
page-layout
access-rights
shellexecute
back-stack
eventlistener
gdata-api
first-responder
errai
postgresql-performance
removeclass
winbugs14
datareader
w3wp.exe
getresponsestream
nintendo-ds
virtual-functions
private-members
genealogy
mdac
uiq3

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App