1
0
mirror of https://git.mills.io/kayos/bitraft.git synced 2024-06-25 00:09:04 +00:00
bitraft/README.md
2017-02-18 09:52:37 -07:00

1.2 KiB

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.