java - If 2 nodes started simultaneously, they don't see each other -


i trying start 2 hazelcast nodes simultaneously, , can not discover each other. it's true both multicast , tcp-ip discovery. if restart 1 node later - see each other. there way make them discover each other without restarting? or how postpone discovery during node start-up?

configuration:

    <network>     <port auto-increment="true">5701</port>     <outbound-ports>         <!--         allowed port range when connecting other nodes.         0 or * means use system provided port.         -->         <ports>0</ports>     </outbound-ports>     <join>         <multicast enabled="true">             <multicast-group>224.3.3.6</multicast-group>             <multicast-port>5705</multicast-port>         </multicast>     </join> </network> 

or

        <multicast enabled="false">             <multicast-group>224.3.3.6</multicast-group>             <multicast-port>5705</multicast-port>         </multicast>         <tcp-ip enabled="true">             <member>host1:5701</member>             <member>host2:5701</member>             <member>host3:5701</member>             <member>host4:5701</member>         </tcp-ip> 

upd: solved manually add random sleep on startup before cluster init.

are nodes running sufficiently long? in experience, can take quite while (30 seconds) until nodes find each other - independent of discovery communication (multicast vs tcpip).

after several trials , erros, hazelcast.com , me found quite simple solution:

config.setproperty("hazelcast.initial.min.cluster.size","2"); 

in experiments, solution faster , more stable waiting while.


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

java.util.scanner - How to read and add only numbers to array from a text file -

iphone - Three second countdown in cocos2d -