-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
643fc1f
commit e127846
Showing
7 changed files
with
51 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
## raft_go | ||
|
||
This is a simple KV database based on `Raft` algorithm,**this implementation is very easy to understand** | ||
|
||
## Usage | ||
|
||
### build | ||
``` | ||
make | ||
``` | ||
|
||
### start-server | ||
```sh | ||
# node1 [leader] | ||
./build/server --local http://127.0.0.1:8080 --peer http://127.0.0.1:8081 --peer http://127.0.0.1:8082 | ||
|
||
# node2 | ||
./build/server --local http://127.0.0.1:8081 --peer http://127.0.0.1:8082 --peer http://127.0.0.1:8080 | ||
|
||
# node3 | ||
./build/server --local http://127.0.0.1:8082 --peer http://127.0.0.1:8081 --peer http://127.0.0.1:8080 | ||
``` | ||
|
||
### start-client | ||
```sh | ||
# set key | ||
./build/client set key1 val1 -a http://127.0.0.1:8080 | ||
|
||
# get key | ||
./build/client get key1 -a http://127.0.0.1:8081 | ||
|
||
# rm key | ||
./build/client rm key1 -a http://127.0.0.1:8080 | ||
|
||
``` | ||
|
||
## Future plan | ||
1. I will change the `MemStorage` method to store the log on disk | ||
2. I'm going to use `LSM trees` and other, more advanced data structures | ||
3. Add tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters