Skip to content
A Bitcask Distributed Key/Value store using Raft for consensus with a Redis compatible API written in Go.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
tools Refactored and stripped down to work with bitcask backend Mar 20, 2019
.drone.yml Fix Drone CI config Mar 21, 2019
.gitignore Refactored and stripped down to work with bitcask backend Mar 20, 2019
.goreleaser.yml Refactored and stripped down to work with bitcask backend Mar 20, 2019
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Dockerfile Add Dockerfile to publish images to the Docker Hub Mar 30, 2019
LICENSE
LICENSE.old Refactored and stripped down to work with bitcask backend Mar 20, 2019
Makefile Refactored and stripped down to work with bitcask backend Mar 20, 2019
README.md Add other badges from img.shields.io Mar 31, 2019
_config.yml
docker-compose.yml Use go-sockaddr/template for -b to make forming a cluster easier. Add… Mar 30, 2019
go.mod Update to bitcask v0.1.6 Apr 1, 2019
go.sum Update to bitcask v0.1.6 Apr 1, 2019
main.go
server.go Fixed KEYS command and bad README documentation Mar 22, 2019
version.go Refactored and stripped down to work with bitcask backend Mar 20, 2019
version_test.go Refactored and stripped down to work with bitcask backend Mar 20, 2019

README.md

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)

You can’t perform that action at this time.