[{"data":1,"prerenderedAt":75},["ShallowReactive",2],{"term-l\u002Fleader-election":3,"related-l\u002Fleader-election":59},{"id":4,"title":5,"acronym":6,"body":7,"category":40,"description":41,"difficulty":42,"extension":43,"letter":44,"meta":45,"navigation":46,"path":47,"related":48,"seo":53,"sitemap":54,"stem":57,"subcategory":6,"__hash__":58},"terms\u002Fterms\u002Fl\u002Fleader-election.md","Leader Election",null,{"type":8,"value":9,"toc":33},"minimark",[10,15,19,23,26,30],[11,12,14],"h2",{"id":13},"eli5-the-vibe-check","ELI5 - The Vibe Check",[16,17,18],"p",{},"When you have several identical servers doing the same job, sometimes one of them needs to be in charge, deciding who gets to write, coordinating the others, without a human picking. Leader election is the process those servers use to vote among themselves for a leader, and just as importantly, to notice when that leader disappears and quickly vote in a replacement.",[11,20,22],{"id":21},"real-talk","Real Talk",[16,24,25],{},"Leader election is a distributed systems process by which nodes in a cluster select a single coordinator to handle tasks that must not be done by multiple nodes at once, such as writing to a resource or scheduling jobs. It is typically implemented using a consensus algorithm like Raft or Paxos, or coordination services like etcd and ZooKeeper, and includes mechanisms to detect leader failure and trigger a new election.",[11,27,29],{"id":28},"when-youll-hear-this","When You'll Hear This",[16,31,32],{},"\"Patroni handles leader election for our Postgres cluster automatically.\" \u002F \"Split-brain happened because two nodes both thought they'd won the leader election.\"",{"title":34,"searchDepth":35,"depth":35,"links":36},"",2,[37,38,39],{"id":13,"depth":35,"text":14},{"id":21,"depth":35,"text":22},{"id":28,"depth":35,"text":29},"architecture","When you have several identical servers doing the same job, sometimes one of them needs to be in charge, deciding who gets to write, coordinating the other...","advanced","md","l",{},true,"\u002Fterms\u002Fl\u002Fleader-election",[49,50,51,52],"Raft","Failover","Consistent Hashing","Two-Phase Commit",{"title":5,"description":41},{"changefreq":55,"priority":56},"weekly",0.7,"terms\u002Fl\u002Fleader-election","OjlSyl9GFoUY83PniePlqvbODT4iDaNKtq5IC8pl2sQ",[60,64,69,72],{"title":51,"path":61,"acronym":6,"category":62,"difficulty":42,"description":63},"\u002Fterms\u002Fc\u002Fconsistent-hashing","networking","Consistent Hashing distributes data across servers so that when you add or remove a server, only a small fraction of data needs to move. Normal hashing?",{"title":50,"path":65,"acronym":6,"category":66,"difficulty":67,"description":68},"\u002Fterms\u002Ff\u002Ffailover","database","intermediate","Failover is what happens when your primary database keels over and, instead of the whole app going down with it, a standby replica gets promoted to take it...",{"title":49,"path":70,"acronym":6,"category":66,"difficulty":42,"description":71},"\u002Fterms\u002Fr\u002Fraft","Raft is a consensus algorithm designed to be understandable, unlike its predecessor Paxos which requires a PhD to read.",{"title":52,"path":73,"acronym":6,"category":66,"difficulty":42,"description":74},"\u002Fterms\u002Ft\u002Ftwo-phase-commit","Two-phase commit (2PC) is like a wedding ceremony for distributed transactions. Phase 1: 'Do you all agree to commit?' Every node says yes or no.",1792528096315]