- 纯Golang实现
- 基于Raft协议
- 移除节点(下线)
go run ./cmd/main.go -id node-1 -haddr localhost:8081 -raddr localhost:9001 \
-rdir ~/data/go-config-center/node1
go run ../cmd/main.go -id node-2 -haddr localhost:8082 -raddr localhost:9002 \
-rdir ~/data/go-config-center/node2 -join localhost:8081
go run ../cmd/main.go -id node-3 -haddr localhost:8083 -raddr localhost:9003 \
-rdir ~/data/go-config-center/node3 -join localhost:8081
初始化后,启动集群就无需join参数
go run ./cmd/main.go -id node-1 -haddr localhost:8081 -raddr localhost:9001 \
-rdir ~/data/go-config-center/node1
go run ../cmd/main.go -id node-2 -haddr localhost:8082 -raddr localhost:9002 \
-rdir ~/data/go-config-center/node2
go run ../cmd/main.go -id node-3 -haddr localhost:8083 -raddr localhost:9003 \
-rdir ~/data/go-config-center/node3
分别在不同的节点上操作数据,根据需要会根据一致性级别自动重定向到Leader节点
curl -X POST http://localhost:8081/key -d '{"foo": "bar"}' -L
curl -X GET http://localhost:8081/key/foo -L
curl -X DELETE http://localhost:8081/key/foo -L
curl -X GET http://localhost:8083/key/foo?level=stale
curl -X GET http://localhost:8082/key/foo?level=default -L
curl -X GET http://localhost:8081/key/foo?level=consistent -L