Terracotta 10.7 | Terracotta Server Administration Guide | Electing an Active Server
 
Electing an Active Server
When a new stripe comes online, the first thing the servers within it need to do is elect an active server which will coordinate the client interactions and passive servers within the stripe.
Additionally, if the active server of an existing stripe goes offline, the remaining passive servers need to elect a replacement active server. Note that only passive servers in the STANDBY state are candidates for this role. For related information, see the section Failover.
In either of these situations, the servers involved address this problem by holding an election.
A server that is started up from rest needs to get votes from all of its peer servers to get elected as an active server. In contrast, votes from a smaller set of peers are sufficient for a running PASSIVE-STANDBY server to become elected as an active server.
If for some reason, not all servers in a stripe can be started up, you can still forcefully get a candidate server elected as active using the cluster tool. For more information about this manual intervention using the cluster tool, see the section The promote command of the Cluster Tool.
High-level process
In an election, each server will construct a "vote" which it sends to the other involved servers. The vote with the highest score can be determined statically, so each server knows it has agreement on which server won the election.
In the case of a tie, the election is re-run until consensus is achieved.
Vote construction
The vote is a list of "weights" which represent the factors which should be considered when electing the most effective active server. The list is ordered in a way that the next element is only considered if the current element is a tie. This allows the earlier elements of the vote to be based around important concepts (such as how many transactions the server has processed), followed by concrete concepts (such as server up-time), then ending in more arbitrary concepts designed to break edge-case ties (such as a randomly generated number).