A small key-value store in Go backed by the Raft consensus algorithm. Multiple nodes agree on a single ordered log of writes; clients can talk over TCP (text protocol) or HTTP/JSON.
- Raft — leader election, log replication, persistence, snapshots, and follower catch-up after restarts (
internal/raft) - 3-node cluster — config-driven peers and addresses (
config/cluster.json) - HTTP API + dashboard —
GET/PUT/DELETEon/keys/{key},/status,/metrics, and a simple UI on/(per-nodehttp_addrin config) - Cluster smoke test —
scripts/cluster_test.sh(build binaries, exercise leader failover and restarts)
- Build:
go build -o bin/kvstore .andgo build -o bin/kvctl ./cmd/kvctl - Start three processes (each in its own terminal), e.g.
./bin/kvstore --id node1 --config config/cluster.json --data data
(repeat fornode2,node3) - Use kvctl against
kv_addrports from config, or open the dashboard at e.g.http://localhost:9001/ - Optional:
bash scripts/cluster_test.sh
go run . --single --data dataUses the original WAL + in-memory store path (no Raft).
- Go 1.21+