简体   繁体   中英

Is it possible to change hazelcast cluster member(s) during runtime

There is hazelcast cluster of 4 VMs.

Is it possible to change its member to localhost while its running (without restart)? ie now all 4 VMs will run with 127.0.0.1:5701 And Vice Versa. All 4 VMs are running with localhost, and at runtime bring them in cluster.

By triggering some event and executing following statement: hazelcastInstance.getConfig().getNetworkConfig().getJoin().getTcpIpConfig().setMembers(members)

If yes, what is the impact of it? when requests are being processed by using hazelcast cached data.

For the most part, configuration must all be set before the cluster is started, and changes made to the configuration when the cluster is running will not take effect.

(Exception: There are certain data structure configuration changes that can be added to a running cluster; see the Configuration section in the reference manual for how to dynamically add configuration).

So, you can't change the configuration in the way you're showing.

However, depending on how configuration was set up in the cluster, you can add additional members, as long as they meet the criteria initially established for the join configuration. So if localhost matches the criteria of the join element's tcpip configuration section, then you can start up one or more nodes on localhost, and they will join the cluster. And when you have these running, you can shut down the non-localhost members one at a time, until the only nodes running are those on localhost. As each node is shut down, its data will migrate to the remaining nodes, which will eventually all be on localhost.

At every point in time, Hazelcast will respond to requests based on the current set of node members - at any point, there will be exactly one node who is the owner for any particular piece of data; the ownership will be transitioning to the local nodes as the various data partitions migrate from remote cluster nodes to local cluster nodes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM