English | 中文
A simple key-value store with raft consensus algorithm.
"RESP is a binary protocol that uses control sequences encoded in standard ASCII. The A character, for example, is encoded with the binary byte of value 65. Similarly, the characters CR (\r), LF (\n) and SP ( ) have binary byte values of 13, 10 and 32, respectively. The \r\n (CRLF) is the protocol's terminator, which always separates its parts."
RESP data type | Minimal protocol version | Category | First byte |
---|---|---|---|
Simple strings | RESP2 | Simple | + |
Simple Errors | RESP2 | Simple | - |
Integers | RESP2 | Simple | : |
Bulk strings | RESP2 | Aggregate | $ |
Arrays | RESP2 | Aggregate | * |
start the server
go run main.go
cd to the kvsctl
directory and run the following commands to interact with the server.
go build -o kvsctl
# Get and Set
./kvsctl GET name
# you can also specify the address of the server
# if you want to change the default address of the server
# you can modify the `kvsctl` file
./kvsctl GET name -a 127.0.0.1:2317
# Raft Cluster
./kvsctl member add 127.0.0.1:2317 127.0.0.1:2318
./kvsctl member remove 127.0.0.1:2317
./kvsctl member list