public enum ClusterState extends Enum<ClusterState>
ClusterState
consists several states of the cluster
which each state can allow and/or deny specific actions
and/or change behaviours of specific actions.
There are 5 states:
ACTIVE
:
Cluster will continue to operate without any restriction.
NO_MIGRATION
:
Migrations (partition rebalancing) and backup replications
are not allowed. Cluster will continue to operate without any restriction.
FROZEN
:
New members are not allowed to join, partition table/assignments will be frozen.
All other operations are allowed and will operate without any restriction.
If some members leave the cluster during it is in FROZEN
state, they can join back.
PASSIVE
:
New members are not allowed to join.
All operations, except the ones marked with AllowedDuringPassiveState
,
will be rejected immediately.
IN_TRANSITION
:
Shows that ClusterState
is in transition.
This is a temporary & intermediate state, not allowed to set explicitly.
ACTIVE
state. During split-brain merge process,
state of the cluster, that is going to join to the major side,
will be changed to FROZEN
automatically before merge
and will be set to the state of the new cluster after merge.Cluster.getClusterState()
,
Cluster.changeClusterState(ClusterState)
,
NodeState
Enum Constant and Description |
---|
ACTIVE
In
ACTIVE state, cluster will continue to operate without any restriction. |
FROZEN
In
FROZEN state of the cluster:
New members are not allowed to join, except the members left during FROZEN or PASSIVE state. |
IN_TRANSITION
Shows that ClusterState is in transition.
|
NO_MIGRATION
In
NO_MIGRATION state of the cluster, migrations (partition rebalancing) and backup replications
are not allowed. |
PASSIVE
In
PASSIVE state of the cluster:
New members are not allowed to join, except the members left during FROZEN or PASSIVE state. |
Modifier and Type | Method and Description |
---|---|
boolean |
isJoinAllowed()
Shows whether new member join is allowed.
|
boolean |
isMigrationAllowed()
Shows whether migrations and replications are allowed.
|
static ClusterState |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static ClusterState[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final ClusterState ACTIVE
ACTIVE
state, cluster will continue to operate without any restriction.
All operations are allowed. This is default state of a cluster.public static final ClusterState NO_MIGRATION
NO_MIGRATION
state of the cluster, migrations (partition rebalancing) and backup replications
are not allowed.
ACTIVE
.
ACTIVE
.
public static final ClusterState FROZEN
FROZEN
state of the cluster:
FROZEN
or PASSIVE
state.
For example, cluster has 3 nodes; A, B and C in FROZEN
state. If member B leaves
the cluster (either proper shutdown or crash), it will be allowed to re-join to the cluster.
But another member D, won't be able to join.
ClusterState
changes back to ACTIVE
.
If that member re-joins in FROZEN
, it will own all previous partition assignments as it is.
If ClusterState
changes to ACTIVE
then partition re-balancing process will
kick-in and all unassigned partitions will be assigned to active members.
It's not allowed to change ClusterState
to FROZEN
when there are pending migration/replication tasks in the system.
NodeState.ACTIVE
state when cluster goes into the FROZEN
state.
public static final ClusterState PASSIVE
PASSIVE
state of the cluster:
FROZEN
or PASSIVE
state.
ClusterState
to PASSIVE
when there are pending migration/replication tasks in the system. If some
nodes leave the cluster while cluster is in PASSIVE
state, they will be removed from the
partition table if cluster state moves back to ACTIVE
.
PASSIVE
, node are moved to NodeState.PASSIVE
.
In this regard, when cluster state moves to another state from PASSIVE
, nodes become
NodeState.ACTIVE
.
AllowedDuringPassiveState
,
will be rejected immediately.
public static final ClusterState IN_TRANSITION
IN_TRANSITION
during the transaction lifecycle.
After transaction completes, it will be in either new state or its previous state
depending on transaction's result.
This is a temporary & intermediate state, not allowed to set explicitly.
FROZEN
state, new members are not allowed
and migration/replication process will be paused.
public static ClusterState[] values()
for (ClusterState c : ClusterState.values()) System.out.println(c);
public static ClusterState valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic boolean isJoinAllowed()
public boolean isMigrationAllowed()
Copyright © 2018 Hazelcast, Inc.. All rights reserved.