A reference implementation by using the Hashicorp Raft lib.
go build -o bin/go-hashicorp-raft-http cmd/*
bin/go-hashicorp-raft-http -id matching1 -raftDir ./snapshots/matching1 -raftAddr :7777 -httpAddr :8887
bin/go-hashicorp-raft-http -id matching2 -raftDir ./snapshots/matching2 -raftAddr :7778 -httpAddr :8888 -joinHttpAddr :8887
bin/go-hashicorp-raft-http -id matching3 -raftDir ./snapshots/matching3 -raftAddr :7779 -httpAddr :8889 -joinHttpAddr :8887
curl -XPOST localhost:8887/key -d '{"x": "3"}'
curl -XPOST localhost:8887/key -d '{"y": "1"}'
curl -XPOST localhost:8887/key -d '{"y": "9"}'
curl -XPOST localhost:8887/key -d '{"x": "2"}'
curl -XPOST localhost:8887/key -d '{"x": "0"}'
curl -XPOST localhost:8887/key -d '{"y": "7"}'
curl -XPOST localhost:8887/key -d '{"x": "5"}'
curl -XPOST localhost:8887/key -d '{"x": "4"}'
curl -XPOST localhost:8887/key -d '{"z": "1"}'
curl -XPOST localhost:8887/key -d '{"z": "2"}'
curl -XPOST localhost:8887/key -d '{"z": "3"}'
curl -XPOST localhost:8887/key -d '{"z": "4"}'
curl -XPOST localhost:8887/key -d '{"z": "5"}'
curl -XPOST localhost:8887/key -d '{"z": "6"}'
curl -XPOST localhost:8887/key -d '{"z": "7"}'
curl -XPOST localhost:8887/key -d '{"z": "8"}'
curl -XPOST localhost:8887/key -d '{"z": "9"}'
curl -XPOST localhost:8887/key -d '{"z": "10"}'
curl -XPOST localhost:8887/key -d '{"z": "11"}'
curl -XPOST localhost:8887/key -d '{"z": "12"}'
curl -XPOST localhost:8887/key -d '{"z": "13"}'
curl -XPOST localhost:8887/key -d '{"z": "14"}'
curl -XPOST localhost:8887/key -d '{"z": "15"}'
curl -XGET localhost:8887/key/x
curl -XPOST localhost:8887/leave -d '{"id": "matching2","addr":":7778"}'
curl -XGET localhost:8887/raftstate
curl -XGET localhost:8887/snapshot
ps aux | grep go-hashicorp-raft-http
kill 58443
- etcd
- zookeeper