Cluster and member states
Cluster states determine what cluster operations are available. By changing the state of a cluster, you can grant or restrict cluster operations such as repartitioning as well as change the behavior of those operations.
You may want to change a cluster's state to do the following:
- Add multiple new members to the cluster without triggering repartitioning after each member joins.
- Perform maintenance on a cluster without triggering repartitioning.
Cluster states control the following operations on partitions:
| Term | Definition |
|---|---|
| Migration | When a primary partition's ownership is transferred from one member to another. Partition ownership is decided by the cluster's master member and is followed by the physical movement of data over the network. |
| Promotion | When the first replica of a partition becomes the primary. This operation requires no movement of data over the network. |
| Replica sync | When the primary partition owner sends its data to replica owners for synchronization. |
For more on partitions and their primary and backup replicas, see Data Partitioning and Replication.
Cluster states
By default, all clusters are in an ACTIVE state. In this state, the cluster operates without restrictions.
All other cluster states restrict the operations on a cluster:
| State | New members | Migrations | Promotions | Replica sync | Use case |
|---|---|---|---|---|---|
ACTIVE | Yes | Yes | Yes | Yes | Normal cluster operation |
NO_ | Yes | No | Yes | Yes | Adding multiple new members to the cluster without triggering repartitioning after each member joins. |
FROZEN | No | No | No | Yes | Performing maintenance on a cluster without triggering repartitioning. |
PASSIVE | No | No | No | Yes | Used internally during graceful cluster-wide shutdowns. In this state, Hazelcast runs read operations such as map. and rejects write operations such as map. with an Illegal. Adding an index with IMap. is an exception: Hazelcast allows it. |
IN_ | No | No | No | No | Used internally as a temporary state while the cluster state is still changing. Repartitioning and backup operations are paused until the state is changed. If an error occurs during a state change that you request, Hazelcast does not try to change the cluster state again. |
Frozen vs no migration
The difference between the FROZEN state and the NO_MIGRATION state is in what happens when a member leaves the cluster.
In a NO_MIGRATION state, when a member leaves the cluster, the first replica of each partition owned by that member is promoted and partitions remain available.
In a FROZEN state, when a member leaves the cluster, the partitions owned by that member are unavailable until it rejoins or the cluster is put back into an ACTIVE state.
Member states
Individual members can be in the following states:
ACTIVE: Members are in this state when the state of a cluster isACTIVE,NO_MIGRATION, orFROZEN. See Cluster States on this page.PASSIVE: Members transition to this state in the following circumstances:- During a graceful shutdown. When the graceful shutdown process is completed, the member's state changes to
SHUT_DOWN. - When the cluster's state is manually changed to
PASSIVE.
- During a graceful shutdown. When the graceful shutdown process is completed, the member's state changes to
SHUT_DOWN: Members transition to this state when they are shut down. Members in this state reject all operations and invocations and cannot be restarted.
Change a cluster's state
To change a cluster's state, you can use one of the following:
- The
changeClusterState()method - Management Center
- The
hz-cluster-adminscript
You cannot change a cluster's state while members are repartitioning or backing up data.