Skip to content

Instantly share code, notes, and snippets.

@otoolep
Created May 16, 2022 23:05
Show Gist options
  • Save otoolep/fe091e6a2acc36be7e3cfb6b1e6d028b to your computer and use it in GitHub Desktop.
Save otoolep/fe091e6a2acc36be7e3cfb6b1e6d028b to your computer and use it in GitHub Desktop.
~ $ mkdir h
~ $ cd h
~/h $ export GOPATH=$PWD
~/h $ go version
go version go1.18.2 linux/amd64
~/h $ mkdir -p src/github.com/otoolep
~/h $ git clone [email protected]:otoolep/hraftd.git
Cloning into 'hraftd'...
remote: Enumerating objects: 1762, done.
remote: Counting objects: 100% (12/12), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 1762 (delta 6), reused 8 (delta 3), pack-reused 1750
Receiving objects: 100% (1762/1762), 2.43 MiB | 7.94 MiB/s, done.
Resolving deltas: 100% (677/677), done.
~/h $ cd hraftd
~/h/hraftd (master)$ go install
go: downloading github.com/hashicorp/raft v1.1.1
go: downloading github.com/hashicorp/raft-boltdb v0.0.0-20191021154308-4207f1bf0617
go: downloading github.com/boltdb/bolt v1.3.1
go: downloading github.com/hashicorp/go-msgpack v0.5.5
go: downloading github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878
go: downloading github.com/hashicorp/go-hclog v0.9.1
go: downloading github.com/hashicorp/go-immutable-radix v1.0.0
go: downloading github.com/hashicorp/golang-lru v0.5.0
~/h/hraftd (master)$ $GOPATH/bin/hraftd -id node0 ~/node0
2022-05-16T19:04:55.211-0400 [INFO] raft: Initial configuration (index=0): []
2022-05-16T19:04:55.212-0400 [INFO] raft: Node at :12000 [Follower] entering Follower state (Leader: "")
2022/05/16 19:04:55 hraftd started successfully
2022-05-16T19:04:56.441-0400 [WARN] raft: Heartbeat timeout from "" reached, starting election
2022-05-16T19:04:56.441-0400 [INFO] raft: Node at :12000 [Candidate] entering Candidate state in term 2
2022-05-16T19:04:56.465-0400 [DEBUG] raft: Votes needed: 1
2022-05-16T19:04:56.465-0400 [DEBUG] raft: Vote granted from node0 in term 2. Tally: 1
2022-05-16T19:04:56.465-0400 [INFO] raft: Election won. Tally: 1
2022-05-16T19:04:56.465-0400 [INFO] raft: Node at :12000 [Leader] entering Leader state
^C2022/05/16 19:05:09 hraftd exiting
~/h/hraftd (master)$ date
Mon 16 May 2022 07:05:10 PM EDT
~/h/hraftd (master)$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment