117503445 / etcd-raft-example

a simple etcd raft example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

etcd-raft-example

a simple etcd raft example

usage

go mod download
go test

go install github.com/mattn/goreman@latest
goreman start

go test -benchmem -run=^$ -bench ^BenchmarkCommit$ github.com/117503445/etcd-raft-example

./build-run.sh
# conf change
./build-run.sh

# in another terminal
curl -L http://127.0.0.1:12380/4 -XPOST -d http://127.0.0.1:42379 # add node 4
./etcd-raft-example --id 4 --cluster http://127.0.0.1:12379,http://127.0.0.1:22379,http://127.0.0.1:32379,http://127.0.0.1:42379 --port 42380 --join


curl -L http://127.0.0.1:12380/5 -XPOST -d http://127.0.0.1:52379 # add node 5
./etcd-raft-example --id 5 --cluster http://127.0.0.1:12379,http://127.0.0.1:22379,http://127.0.0.1:32379,http://127.0.0.1:42379,http://127.0.0.1:52379 --port 52380 --join

curl -L http://127.0.0.1:12380/4 -XDELETE # delete node 4

doc

https://github.com/etcd-io/etcd/tree/main/contrib/raftexample

https://github.com/etcd-io/etcd/tree/main/raft

License

most code from https://github.com/etcd-io/etcd/tree/main/contrib/raftexample

etcd-raft-example is under the Apache 2.0 license. See the LICENSE file for details.

About

a simple etcd raft example

License:Apache License 2.0


Languages

Language:Go 96.8%Language:Python 1.7%Language:Procfile 1.3%Language:Shell 0.2%