Raft is a consensus protocol for a cluster of peers to maintain a replicated log. Raft is a crash fault tolerant (CFT) protocol; i.e. machines can fail by crashing or network partition, but are NOT malicious (byzantine). Peers follow the protocol.
- Clone https://github.com/cnnrznn/raft-postman for a postman collection
designed for use with
/cmd/httpraft
- Build the
httpraft
binarycd cmd/httpraft go build
- Create a config file defining the network, such as
Place this file in the working directory from which you'll run
{ "peers": [ "localhost:8000", "localhost:8001", "localhost:8002" ], "apis": [ "localhost:9000", "localhost:9001", "localhost:9002" ] }
./httpraft
- Run
./httpraft <id>
whereid
is the index inpeers
andapis
the node will listen. - Point the
leader
environment variable in the postman collection to one of of theapis
addresses.
I am currently in the process of implementing the protocol. Here is the list of tasks:
- Leader election protocol
- Log append protocol
- Module interface for Go clients
- Http REST interface for Web clients
I am implementing the protocol as a go module. I will write instructions later for installing and using the module in your go program. I am also implementing a runnable binary that will accept requests (appends) and reads from the log via HTTP REST endpoints.
- Membership changes
- Persistence
- Log compaction