@Beta
public interface HighAvailabilityManager
ManagementPlaneSyncRecordPersister
) to detect
if the current master has failed or stopped. If so, then deterministically chooses a new master.
If that master is self, then promotes.
Users are not expected to implement this class, or to call methods on it directly.
Expected lifecycle of methods calls on this is:
Modifier and Type | Method and Description |
---|---|
void |
changeMode(HighAvailabilityMode mode)
changes the mode that this HA server is running in
|
void |
disabled()
Indicates that HA is disabled: this node will act as the only management node in this management plane,
and will not persist HA meta-information (meaning other nodes cannot join).
|
ManagementPlaneSyncRecord |
getManagementPlaneSyncState()
Returns a snapshot of the management-plane's current / most-recently-known status.
|
ManagementNodeState |
getNodeState() |
ManagementPlaneSyncRecordPersister |
getPersister() |
long |
getPriority() |
boolean |
isRunning()
Whether HA mode is operational
|
HighAvailabilityManager |
setPersister(ManagementPlaneSyncRecordPersister persister) |
void |
setPriority(long priority)
sets the priority, and publishes it synchronously so it is canonical
|
void |
start(HighAvailabilityMode startMode)
Starts the monitoring of other nodes (and thus potential promotion of this node from standby to master).
|
void |
stop()
Stops this node, then publishes own status (via
ManagementPlaneSyncRecordPersister of ManagementNodeState.TERMINATED . |
ManagementNodeState getNodeState()
HighAvailabilityManager setPersister(ManagementPlaneSyncRecordPersister persister)
persister
- @Beta void disabled()
Subsequently can expect getNodeState()
to be ManagementNodeState.MASTER
and getManagementPlaneSyncState()
to show just this one node --
as if it were running HA with just one node --
but isRunning()
will return false.
Currently this method is intended to be called early in the lifecycle,
instead of start(HighAvailabilityMode)
. It may be an error if
this is called after this HA Manager is started.
boolean isRunning()
void start(HighAvailabilityMode startMode)
When this method returns, the status of this node will be set,
either ManagementNodeState.MASTER
if appropriate
or ManagementNodeState.STANDBY
/ ManagementNodeState.HOT_STANDBY
.
startMode
- mode to start withjava.lang.IllegalStateException
- if current state of the management-plane doesn't match that desired by startMode
void stop()
ManagementPlaneSyncRecordPersister
of ManagementNodeState.TERMINATED
.void changeMode(HighAvailabilityMode mode)
note it will be an error to changeMode(HighAvailabilityMode)
to ManagementNodeState.MASTER
when there is already a master; to promote a node explicitly set its priority higher than
the others and invoke changeMode(HighAvailabilityMode)
to a standby mode on the existing master
void setPriority(long priority)
long getPriority()
ManagementPlaneSyncRecord getManagementPlaneSyncState()
This is mainly the nodes and their ManagementNodeSyncRecord
instances,
as known (for this node) or last read (other nodes).
ManagementPlaneSyncRecordPersister getPersister()