Package io.aeron.cluster
The purpose of Aeron Cluster is to aggregate and sequence streams from cluster clients into a single log. A number of
nodes will replicate and archive the log to achieve fault tolerance.
ClusteredServices deterministically process the log and respond to cluster clients.
Aeron Cluster works on the concept of a strong leader using an adaptation of the Raft algorithm. The leader sequences the log and is responsible for replicating it to other cluster members known as followers.
A number of components make up Aeron Cluster. Central is the ConsensusModule which sequences
the log and coordinates consensus for the recording of the sequenced log to persistent storage, and the services
consuming the log across cluster members. Aeron Archive records the log to durable storage.
Services consume the log once a majority of the cluster members have safely recorded the log to durable storage.
To enable fast recovery, the services and consensus module can take a snapshot of their state as of a given log
position thus enabling recovery by loading the most recent snapshot and replaying logs from that point forward.
Snapshots are recorded as streams in the Archive for local and remote replay so that a
distributed file system is not required.
Usage
The cluster can run in various configurations:- Single Node: For development, debugging, or when a sequenced and archived log on a single node is sufficient.
- Appointed Leader: A leader of the cluster can be appointed via configuration without requiring an election. In the event of a leader failure then a follower will have to be manually appointed the new leader. This is not the recommended way to use Cluster. Automatic elections are more reliable.
- Automatic Elections: Automatic elections (default) can be enabled to have a leader elected at random from the members with the most up to date log.
The majority of cluster members determine consensus. Clusters should typically be 3 or 5 in population size. However, 2 node clusters are supported whereby both members must agree the log and in the event of failure the remaining member must be manually reconfigured as a single node cluster to progress.
Protocol
Messages are specified using SBE in this schema aeron-cluster-codecs.xml-
ClassDescriptionAn
AuthorisationServicethat allows the actions required by Cluster Backup and Aeron Cluster Standby.Class to be used for determining AppVersion compatibility.Backup component which can run remote from a cluster which polls for snapshots and replicates the log.Configuration options forClusterBackupwith defaults and constants for system properties lookup.Determines what position to start from when backing up the log from the cluster.Context for overriding default configuration forClusterBackup.Defines the type of node that this will receive log data from.State of the cluster backup state machine.Agentwhich backs up a remote cluster by replicating the log and polling for snapshots.Listener which can be registered viaClusterBackup.Contextfor tracking backup progress.Representation of a client session to an Aeron Cluster for use in anConsensusModuleExtension.Toggle controlClusterControl.ToggleStates for a cluster node such asClusterControl.ToggleState.SUSPENDorClusterControl.ToggleState.RESUME.Toggle states for controlling the cluster node once it has entered the active state after initialising.Clustered archive which is an aggregate of aConsensusModuleand anArchive.Represents a member of the cluster that participates in consensus for storing state from the perspective of any single member.Detail for the cluster membership from the perspective of a given member.Tool for control and investigating the state of a cluster node.A command to be used by ClusterTool.Functional interface of a cluster tool operator action used inClusterToolCommand.Actions for an operator tool to control cluster.The state needed to allow control of the consensus module.Component which resides on each node and is responsible for coordinating consensus within a cluster in concert with the lifecycle of clustered services.Configuration options for cluster.Programmable overrides for configuring theConsensusModulein a cluster.Possible states for theConsensusModule.Control interface for performing operations on the consensus module from aConsensusModuleExtension.Extension for handling messages from external schemas unknown to core Aeron Cluster code thus providing an extension to the core ingress consensus module behaviour.A tool to patch the latest consensus module snapshot if it has divergence in the pending service messages state.Election states for aConsensusModulewhich get represented by aElectionState.code()stored in aCounterof the typeConsensusModule.Configuration.ELECTION_STATE_TYPE_ID.AClusterClockimplemented by callingSystem.currentTimeMillis().AClusterClockimplemented by callingHighResolutionClock.epochNanos().Toggle controlNodeControl.ToggleStates for a cluster node such asNodeControl.ToggleState.REPLICATE_STANDBY_SNAPSHOT.Toggle states for controlling the cluster node once it has entered the active state after initialising.An extensible list of information relating to a specific cluster node.Supplies instances of thePriorityHeapTimerService.A log of recordings which make up the history of a Raft log across leadership terms.Representation of the entry in theRecordingLog.Representation of a log entry in theRecordingLog.The snapshots and steps to recover the state of a cluster.Representation of a snapshot entry in theRecordingLog.Timer service providing API to schedule timers in the Cluster.Called from theTimerService.poll(long).Called from theTimerService.snapshot(TimerSnapshotTaker).Supplier ofTimerServiceimplementations to be used by theConsensusModule.Supplies an instance of aWheelTimerServicebased on the configuration given to the constructor.