etcd-raft-example

command module
v0.0.0-...-e2071b6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2022 License: Apache-2.0 Imports: 27 Imported by: 0

README

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.

Documentation

Overview

raftexample is a simple KV store using the raft and rafthttp libraries.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL