1
0
mirror of https://git.mills.io/kayos/bitraft.git synced 2024-06-16 11:58:58 +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
2019-04-01 10:13:14 +10:00
tools Refactored and stripped down to work with bitcask backend 2019-03-20 18:18:33 +10:00
_config.yml Set theme jekyll-theme-hacker 2019-03-22 06:38:43 +10:00
.drone.yml Fix Drone CI config 2019-03-22 07:55:12 +10:00
.gitignore Refactored and stripped down to work with bitcask backend 2019-03-20 18:18:33 +10:00
.goreleaser.yml Refactored and stripped down to work with bitcask backend 2019-03-20 18:18:33 +10:00
CONTRIBUTING.md Create CONTRIBUTING.md 2019-04-01 10:13:14 +10:00
docker-compose.yml Use go-sockaddr/template for -b to make forming a cluster easier. Add docker-compose.yml as a demo cluster 2019-03-30 23:47:51 +10:00
Dockerfile Add Dockerfile to publish images to the Docker Hub 2019-03-30 17:37:11 +10:00
go.mod Use go-sockaddr/template for -b to make forming a cluster easier. Add docker-compose.yml as a demo cluster 2019-03-30 23:47:51 +10:00
go.sum Use go-sockaddr/template for -b to make forming a cluster easier. Add docker-compose.yml as a demo cluster 2019-03-30 23:47:51 +10:00
LICENSE Refactored and stripped down to work with bitcask backend 2019-03-20 18:18:33 +10:00
LICENSE.old Refactored and stripped down to work with bitcask backend 2019-03-20 18:18:33 +10:00
main.go Use go-sockaddr/template for -b to make forming a cluster easier. Add docker-compose.yml as a demo cluster 2019-03-30 23:47:51 +10:00
Makefile Refactored and stripped down to work with bitcask backend 2019-03-20 18:18:33 +10:00
README.md Add other badges from img.shields.io 2019-03-31 13:40:54 +10:00
server.go Fixed KEYS command and bad README documentation 2019-03-22 20:39:45 +10:00
version_test.go Refactored and stripped down to work with bitcask backend 2019-03-20 18:18:33 +10:00
version.go Refactored and stripped down to work with bitcask backend 2019-03-20 18:18:33 +10:00

bitraft

Build Status Go Report Card GitHub license Github all releases

A Bitcask Distributed Key/Value store using Raft for concensus with a Redis compatible API written in Go.

Based off of kvnode. (See LICENSE.old)

  • Redis compatible API
  • Bitcask disk-based storage
  • Raft support with Finn commands
  • Compatible with existing Redis clients

Usage

$ go get github.com/prologic/bitraft
$ bitraft

Docker

You can also use the Bitraft Docker Image:

$ docker pull prologic/bitraft
$ docker run -d -p 4920:4920 prologic/bitraft

Example session

Commands:

SET key value
GET key
DEL key [key ...]
KEYS [WITHVALUES]
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 bitraft --parse-snapshot and redis-cli --pipe commands

Example:

bitraft --parse-snapshot state.bin | redis-cli -h 10.0.1.5 -p 4920 --pipe

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

For information on the redis-cli --pipe command see Redis Mass Insert.

License

bitraft source code is available under the MIT License.

Previously based off of kvnode. (See LICENSE.old)