Operating Aeron cluster¶
Cluster Tool¶
Cluster Tool allows you to operate a running cluster, including describing the cluster, changing membership, taking snapshots and clean shutdowns.
Obtaining Cluster Tool¶
Cluster Tool is found in the aeron-all jar, which can be downloaded from Maven Central. The tool is run pointing at the cluster folder, unlike AeronStat which needs to point at the Aeron directory.
Describing the Cluster¶
During operational incident investigations, one of the first things one needs to do is understand the state of the cluster. The describe
option does this.
➜ java -cp /Users/u001/src/aeron-all-*.jar io.aeron.cluster.ClusterTool . describe
INFO: Mark file exists: ./cluster-mark.dat
Type: CONSENSUS_MODULE 19:36:24 (start: 2020-05-28 19:18:26, activity: 2020-05-28 19:18:34)
[MarkFileHeader](sbeTemplateId=200|sbeSchemaId=110|sbeSchemaVersion=0|sbeBlockLength=128):version=512|componentType=CONSENSUS_MODULE|activityTimestamp=1590707914066|startTimestamp=1590707906036|pid=68862|candidateTermId=-1|archiveStreamId=11|serviceStreamId=104|consensusModuleStreamId=105|ingressStreamId=101|memberId=0|serviceId=-1|headerLength=8192|errorBufferLength=1048576|clusterId=0|aeronDirectory='/var/folders/np/9nn7kn7d15qfc7qcnt9rbsgm0000gn/T/aeron-u001'|controlChannel='aeron:ipc?term-length=64k|mtu=8k'|ingressChannel='aeron:udp?endpoint=localhost:9010'|serviceName=''|authenticator='class io.aeron.security.DefaultAuthenticatorSupplier'
INFO: Mark file exists: ./cluster-mark-service-0.dat
Type: CONTAINER 19:36:24 (start: 2020-05-28 19:18:26, activity: 2020-05-28 19:18:33)
[MarkFileHeader](sbeTemplateId=200|sbeSchemaId=110|sbeSchemaVersion=0|sbeBlockLength=128):version=512|componentType=CONTAINER|activityTimestamp=1590707913147|startTimestamp=1590707906122|pid=68862|candidateTermId=-1|archiveStreamId=11|serviceStreamId=104|consensusModuleStreamId=105|ingressStreamId=-1|memberId=0|serviceId=0|headerLength=8192|errorBufferLength=1048576|clusterId=0|aeronDirectory='/var/folders/np/9nn7kn7d15qfc7qcnt9rbsgm0000gn/T/aeron-u001'|controlChannel='aeron:ipc?term-length=64k|mtu=8k'|ingressChannel=''|serviceName='clustered-service'|authenticator=''
Listing members¶
Cluster tool can also list the members of the cluster:
➜ java -cp /Users/u001/src/aeron-all-*.jar io.aeron.cluster.ClusterTool . list-members
INFO: Mark file exists: ./cluster-mark.dat
currentTimeNs=1591054805865000000, leaderMemberId=0, memberId=0, activeMembers=[ClusterMember{id=0, isBallotSent=false, isLeader=false, hasRequestedJoin=false, leadershipTermId=4, logPosition=20224, candidateTermId=-1, catchupReplaySessionId=-1, correlationId=-1, removalPosition=-1, timeOfLastAppendPositionNs=1591054805865000000, ingressEndpoint='localhost:9003', consensusEndpoint='localhost:9004', logEndpoint='localhost:9005', catchupEndpoint='localhost:9006', archiveEndpoint='localhost:9001', endpoints='localhost:9003,localhost:9004,localhost:9005,localhost:9006,localhost:9001', publication=null, vote=null}], passiveMembers=[]
Inspecting the recording log¶
The recording log can be inspected. This shows the recording.
➜ java -cp /Users/u001/src/aeron-all-*.jar io.aeron.cluster.ClusterTool . recording-log
RecordingLog{entries=[Entry{recordingId=0, leadershipTermId=0, termBaseLogPosition=0, logPosition=96, timestamp=1590707882622, serviceId=-1, type=0, isValid=true, entryIndex=0}, Entry{recordingId=0, leadershipTermId=1, termBaseLogPosition=96, logPosition=-1, timestamp=1590707906982, serviceId=-1, type=0, isValid=true, entryIndex=1}], cacheIndex={1=1, 0=0}}
Taking a snapshot¶
Cluster tool can be used to take a snapshot, although this requires that the running cluster has the appropriate code to write and read snapshots.
➜ java -cp /Users/u001/src/aeron-all-*.jar io.aeron.cluster.ClusterTool . snapshot
INFO: Mark file exists: ./cluster-mark.dat
Member [0]: SNAPSHOT applied successfully
Listing errors¶
Errors raised and captured by Aeron Cluster & Aeron are provided:
➜ java -cp /Users/u001/src/aeron-all-*.jar io.aeron.cluster.ClusterTool . errors
INFO: Mark file exists: ./cluster-mark.dat
Type: CONSENSUS_MODULE 19:41:41 (start: 2020-05-28 19:18:26, activity: 2020-05-28 19:18:34)
Cluster component error log:
Aeron driver error log (directory: /var/folders/np/9nn7kn7d15qfc7qcnt9rbsgm0000gn/T/aeron-u001):
INFO: Mark file exists: ./cluster-mark-service-0.dat
Type: CONTAINER 19:41:41 (start: 2020-05-28 19:18:26, activity: 2020-05-28 19:18:33)
Cluster component error log:
For common errors, see Cluster Errors
Obtaining the PID for the Cluster process¶
Cluster tool can obtain the operating system PID for the cluster pointing at this folder:
➜ java -cp /Users/u001/src/aeron-all-*.jar io.aeron.cluster.ClusterTool . pid
68862
Shutting down the cluster¶
Cluster tool can shutdown the cluster:
➜ java -cp /Users/u001/src/aeron-all-*.jar io.aeron.cluster.ClusterTool . shutdown
INFO: Mark file exists: ./cluster-mark.dat
Member [0]: SHUTDOWN applied successfully