Skip to content

A Go based implementation of Raft underpinning a key-value store

License

Notifications You must be signed in to change notification settings

mukeshjc/raft-kv-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ensure the project builds

go build

Ensure the k/v db builds

cd kvapi
go build

Note:
should see a file called kvapi.exe (on windows) if successfully built
before starting the server ensure to cleanup previous *.dat files using rm *.dat in the '/kvapi' directory.

Start the server in 3 terminals

./kvapi --node 0 --http :2020 --cluster "0,:3030;1,:3031;2,:3032"
./kvapi --node 1 --http :2020 --cluster "0,:3030;1,:3031;2,:3032"
./kvapi --node 2 --http :2020 --cluster "0,:3030;1,:3031;2,:3032"

Query the k/v db

curl "http://localhost:2020/set?key=x&value=hello"

Note:
if the curl request fails, then retry another server port as the request has to go to the leader for it to be processed


raft state, rpc and server rules

About

A Go based implementation of Raft underpinning a key-value store

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages