goPaxos is an implementation of a single instance of the Paxos consensus algorithm in Go. It is based on the outline given in Paxos Made Simple. The main components of the algorithm - proposers, acceptors and learners - are implemented in their respective packages.
- Run
makein thesrc/paxosdirectory.
> make
go install ./...- Add
bin/from the repository to yourPATH. - Create a configuration file with the host:port information for proposers, acceptors and learners.
> init-config -np 2 -na 3 -nl 2
{
"Proposers": [
"localhost:34379",
"localhost:34380"
],
"Acceptors": [
"localhost:34381",
"localhost:34382",
"localhost:34383"
],
"Learners": [
"localhost:34384",
"localhost:34385"
]
}- Start proposer, acceptors, learners.
> init-proposer &
> init-acceptor &
> init-learner &- Simple: This is the normal case. A proposer proposes a value. All learners should get that value eventually.
> simple
PASS.- Concur: Two proposers propose a value concurrently. All learners should get the same value eventually.
> concur
PASS with hello_world2- Distinguished Proposer - Use zookeeper for leader election.
- Multi-Paxos - Support for multiple instances of the algorithm to build a replicated state machine.
- Fault Tolerance - Test single/multi paxos with random failures.