Getting all the nodes in distributed system to agree on something
Assume a database with with single leader replication
If the leader dies, remaining nodes can use consensus to elect a new leader
If two nodes believe that they are leader, the situation is called split brain
Split brain can lead to data loss, hence consensus should be implemented correctly
Algorithms:
Paxos
Raft (based on Paxos)
Phase King (also handles Byzantine fault)
Paxos
Paxos is an algorithm that enables a distributed set of computers (for example, a cluster of distributed database nodes) to achieve consensus over an asynchronous network.