1
0
mirror of https://git.mills.io/kayos/bitraft.git synced 2024-06-16 03:48:56 +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
2021-03-16 09:42:03 +10:00
.dependabot Added DependaBot config 2019-12-26 14:01:44 +10:00
.github Drop support for Windows 2021-03-16 09:42:03 +10:00
tools Fixed typo in release.sh (#2) 2019-04-25 22:22:26 +10:00
_config.yml Set theme jekyll-theme-hacker 2019-03-22 06:38:43 +10:00
.dockerignore Build minimal Docker image that runs without root priviledges (#45) 2021-02-18 18:23:39 +10:00
.gitignore Refactored and stripped down to work with bitcask backend 2019-03-20 18:18:33 +10:00
.goreleaser.yml Drop support for Windows 2021-03-16 09:42:03 +10:00
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md (#1) 2019-04-01 10:13:27 +10:00
CONTRIBUTING.md Create CONTRIBUTING.md 2019-04-01 10:13:14 +10:00
docker-stack.yml Rename the example Docker configuration as it's actually a Docker Stack 2021-02-09 22:41:56 +10:00
Dockerfile Bump golang from 1.15 to 1.16.0 (#48) 2021-02-23 07:20:05 +10:00
go.mod Bump github.com/sirupsen/logrus from 1.8.0 to 1.8.1 (#49) 2021-03-10 05:59:06 +10:00
go.sum Bump github.com/sirupsen/logrus from 1.8.0 to 1.8.1 (#49) 2021-03-10 05:59:06 +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 edit Makefile: 'make lint' runs golangci-lint (#46) 2021-02-17 16:48:45 +10:00
README.md redis-cli compliant 'KEYS' command: fixes issue #39 (#44) 2021-02-17 16:57:12 +10:00
server.go redis-cli compliant 'KEYS' command: fixes issue #39 (#44) 2021-02-17 16:57:12 +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

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 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)