🎉 A Bitcask Distributed Key/Value store using Raft for consensus with a Redis compatible API written in Go.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Tai Groot 9df3b6443f go mod tidy (#56) 2 months ago
tools Fixed typo in release.sh (#2) 2 years ago
.dockerignore Build minimal Docker image that runs without root priviledges (#45) 7 months ago
.gitignore Refactored and stripped down to work with bitcask backend 3 years ago
.goreleaser.yml Drop support for Windows 7 months ago
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md (#1) 3 years ago
CONTRIBUTING.md Create CONTRIBUTING.md 3 years ago
Dockerfile Bump golang from 1.16.4 to 1.16.5 (#55) 4 months ago
LICENSE Refactored and stripped down to work with bitcask backend 3 years ago
LICENSE.old Refactored and stripped down to work with bitcask backend 3 years ago
Makefile edit Makefile: 'make lint' runs golangci-lint (#46) 7 months ago
README.md Fix import paths 3 months ago
_config.yml Set theme jekyll-theme-hacker 3 years ago
docker-stack.yml Rename the example Docker configuration as it's actually a Docker Stack 8 months ago
go.mod go mod tidy (#56) 2 months ago
go.sum go mod tidy (#56) 2 months ago
main.go Use go-sockaddr/template for -b to make forming a cluster easier. Add docker-compose.yml as a demo cluster 3 years ago
server.go Fix import paths 3 months ago
version.go Refactored and stripped down to work with bitcask backend 3 years ago
version_test.go Refactored and stripped down to work with bitcask backend 3 years ago

README.md

bitraft

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 git.mills.io/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 pattern
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)