Raft Consensus Protocol (dRaft)

Poster from Unsplash
Github Repository:
https://github.com/cadevue/draft
This program is a simple simulation of the Raft Consensus Protocol. The program is implemented in golang.
How to Run 🚀
Running the Server 🖥️
-
As first node (automatically become leader)
go run server/server.go <ip server> <port server>
-
As follower node
go run server/server.go <ip server> <port server> <ip leader server> <port leader server>
Running the Client 👨🏻💼
Method 1: Web Interface 🧩
go run web-client/web_client.go <ip server> <port server>
Method 2: The Terminal </>
go run client/client.go <ip server> <port server>
Notes: Make sure the leader server address is an active leader node, if not the terminal will prompt the correct leader address
Available Command
-
Ping
Checking the server connection.ping
The server will response with:
Pong!
-
Get
Get a value with a key.get <key>
The server will response with:
<value>
If the key doesn’t exist, it will return empty string.
-
Set
Set new value for specific key.set <key> <value>
The server will response with:
OK
If the key doesn’t exist, new pair will be created. This command only available for leader node, if not it will return error message and a correct leader address. This command will be logged.
-
Strln
Get the length of a value with a key.strln <key>
The server will response with:
<value length>
If the key doesn’t exist, it will return -1.
-
Del
Delete value for specific key.del <key>
The server will response with:
<deleted value>
If the key doesn’t exist, it will return empty string. This command only available for leader node, if not it will return error message and a correct leader address. This command will be logged.
-
Append
Append value for specific key.append <key> <value>
The server will response with:
OK
If the key doesn’t exist, new pair will be created. This command only available for leader node, if not it will return error message and a correct leader address. This command will be logged.
-
Switch
Switch server port.switch <ip server> <port server>
The server will response with:
OK
-
Request Log
Get server’s log.request_log
The server will response with:
<server log>
Contributors
Made by Team dRaft
- Naufal Syifa Firdaus (nomsf)
- Louis Caesa Kesuma (Ainzw0rth)
- Husnia Munzayana (munzayanahusn)
- Addin Munawwar Yusuf (cadevue)
- Puti Nabilla Aidira (Putinabillaa)