I would like to direct any node in Aeron Cluster to become leader, no elections. The previous leader automatically becomes a follower, never attempting to assume leadership (unless directed externally).
I looked at Cluster/Role
, ClusterTool
and AeronCluster
APIs and nothing seemed helpful. I also checked AppointedLeaderTest
and it boils down to initially specify leader with ConsesusModule.Context.appointedLeaderId
, but no way to change it afterwards dynamically?
How to do this?
It is not possible to run an Aeron cluster as you are suggesting. (Aeron 1.27.0)
Aeron cluster is based on the RAFT consensus algorithm, it defines the election protocol and that dictates that the node which has the most advanced log at that point in time will become leader.
Assigning the appointedLeaderId prevents nodes not specified from proposing themselves as candidates in an election.
You may be able to achieve some of what you want by using dynamic membership.
Or given a static cluster, a slightly more brute force approach would be to:
Note: the complexity/computational expense of either of these solutions would likely outweigh any benefit of being able to appoint a node as leader.