With the release of 3.6, Hazelcast introduces cluster and member states in addition to the default ACTIVE
state. This section explains these states of Hazelcast clusters and members which you can use to allow or restrict the designated cluster/member operations.
By changing the state of your cluster, you can allow/restrict several cluster operations or change the behavior of those operations. You can use the methods changeClusterState()
and shutdown()
which are in the Cluster interface to change your cluster's state.
Hazelcast clusters have the following states:
ACTIVE
: This is the default cluster state. Cluster continues to operate without restrictions.
FROZEN
: ACTIVE
. When it joins back to the cluster, it will own all previous partition assignments as it was. On the other hand, when the cluster state changes to ACTIVE
, re-partitioning starts and unassigned partitions are assigned to the active members.FROZEN
when migration/replication tasks are being performed.
PASSIVE
:ACTIVE
. map.get()
and cache.get()
, replication and cluster heartbeat tasks. PASSIVE
when migration/replication tasks are being performed.
IN_TRANSITION
: IN_TRANSITION
explicitly. NOTE: All in-cluster methods are fail-fast, i.e. when a method fails in the cluster, it throws an exception immediately (it will not be retried).
The following snippet is from the Cluster
interface showing the new methods used to manage your cluster's states.
public interface Cluster {
...
...
ClusterState getClusterState();
void changeClusterState(ClusterState newState);
void changeClusterState(ClusterState newState, TransactionOptions transactionOptions);
void shutdown();
void shutdown(TransactionOptions transactionOptions);
Please refer to the Cluster interface for information on these methods.
Hazelcast cluster members have the following states:
ACTIVE
: This is the initial member state. The member can execute and process all operations. When the state of the cluster is ACTIVE
or FROZEN
, the members are in the ACTIVE
state.
PASSIVE
: In this state, member rejects all operations EXCEPT the read-only ones, replication and migration operations, heartbeat operations, and the join operations as explained in the Cluster States section above. A member can go into this state when either of the following happens:Node.shutdown(boolean)
is called. Note that, when the shutdown process is completed, member's state changes to SHUT_DOWN
. PASSIVE
using the method changeClusterState()
.
SHUT_DOWN
: A member goes into this state when the member's shutdown process is completed. The member in this state rejects all operations and invocations. A member in this state cannot be restarted.