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

What is EJB alternative in Spring Framework
Default value for date in FreeMarker
Using Olingo v2 Java as client for PATCH to OData v2 service
Is assigning variables directly to a wrapper class a good practice in Java?
How to make a circle disappear when clicked?
How to grab a particular log file and show its content in jenkins Console output
storing value of EditText to a string variable is not working
Bubble-Sort 2D array
Not static java interface
Creating objects in loops
How to load external file into classpath Play Framework 2.3
Use URL in Javadoc
Mybatis insert custom object
Is there an IDE for java that does not need a compiler like Python?
Android- Saving a photo I have taking into my Gallery [duplicate]
for each loop with a second boolean parameter [duplicate]

Categories

HOME
image
cloud
single-sign-on
comparison
vmware
react-router
packages
mvvmcross
cloudkit
gnupg
mapserver
hex-editors
try-catch
iolanguage
clojurescript
pythonanywhere
predix
nas
accessor
bootstrap-tour
pepper
react-css-modules
entitlements
web-api-testing
elasticsearch-ruby
xacml
libuv
vision
key-value-observing
google-cloud-endpoints-v2
.net-4.0
xquery-3.0
titanium-mobile
vsts-build-task
asset-pipeline
azure-sql-database
fusionpbx
abstract-class
vapor
dynamic-reports
firebase-admin
fakeiteasy
no-www
bootstrap-dialog
angular2-meteor
taffy
scrollable
qsslsocket
rails-routing
python-c-api
worksheet
colorama
worker-thread
sybase-asa
zendesk-app
bind9
pycaffe
spring-android
underscore.js-templating
multiple-regression
ready-api
livequery
ipconfig
associative-array
wso2cloud
msys
kcachegrind
interrupted-exception
nsight
bigbluebutton
npapi
jsonpickle
gulp-less
web2py-modules
blending
ril
anonymous-methods
bitsharp
automount
parametric-equations
postgresql-performance
asyncfileupload
cufon
appendto
inotifycollectionchanged
remember-me
asp.net-mvc-areas
gallio
wise
sproutcore-2
nsviewanimation
sustainable-pace

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App