Theoretically, you have two types of leaders:
- Leader in Deployment Times
- Runtime leader
To set the Deploy-time leader, use leader_only.
To set a leader at runtime, youβre on your own.
Because the instance that was the leader during the deployment,
may not be nearby for various reasons, for example, reduce.
Good solutions do not exist, although some attempts are scattered.
For my own needs, I created a solution that lists all instance IDs, sorts them in alphabetical order, and first selects as a leader.
source share