1
0
mirror of https://git.mills.io/kayos/bitraft.git synced 2024-06-27 09:19:00 +00:00
A Bitcask Distributed Key/Value store using Raft for consensus with a Redis compatible API written in Go. Personal fork.
Go to file
2017-02-18 09:52:37 -07:00
cmd/kvnode-server backup and restore 2017-02-18 09:52:37 -07:00
vendor added glide and gitignore 2017-02-18 08:45:23 -07:00
.gitignore added glide and gitignore 2017-02-18 08:45:23 -07:00
glide.lock added glide and gitignore 2017-02-18 08:45:23 -07:00
glide.yaml added glide and gitignore 2017-02-18 08:45:23 -07:00
LICENSE renamed 2017-01-31 06:58:02 -07:00
Makefile renamed 2017-01-31 06:58:02 -07:00
README.md backup and restore 2017-02-18 09:52:37 -07:00
server.go backup and restore 2017-02-18 09:52:37 -07:00

kvnode

Very simple key value store.

  • Redis API
  • LevelDB storage
  • Raft support with Finn commands.

Commands:

SET key value
GET key
DEL key [key ...]
PDEL pattern
KEYS pattern [PIVOT prefix] [LIMIT count] [DESC] [WITHVALUES]
MSET key value [key value ...]
MGET key [key ...]
FLUSHDB
SHUTDOWN

Backup and Restore

To backup data:

RAFTSNAPSHOT

This will creates a new snapshot in the data/snapshots directory. Each snapshot contains two files, meta.json and state.bin. The state file is the database in a compressed format. The meta file is details about the state including the term, index, crc, and size.

Ideally you call RAFTSNAPSHOT and then store the state.bin on some other server like S3.

To restore:

  • Create a new raft cluster
  • Download the state.bin snapshot
  • Pipe the commands using the kvnode-server --parse-snapshot and redis-cli commands

Example:

kvnode-server --parse-snapshot state.bin | redis-cli -h 10.0.1.5 -p 4920

This will execute all of the state.bin commands on the leader at 10.0.1.5:4920

Contact

Josh Baker @tidwall

License

kvnode source code is available under the MIT License.