1
0
mirror of https://git.mills.io/kayos/bitraft.git synced 2024-06-24 07:48:53 +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
dependabot-preview[bot] 8f3e737201
Bump github.com/tidwall/redcon from 1.2.1 to 1.3.2 (#18)
Bumps [github.com/tidwall/redcon](https://github.com/tidwall/redcon) from 1.2.1 to 1.3.2.
- [Release notes](https://github.com/tidwall/redcon/releases)
- [Commits](https://github.com/tidwall/redcon/compare/v1.2.1...v1.3.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2020-03-07 14:14:04 +10:00
.dependabot Added DependaBot config 2019-12-26 14:01:44 +10:00
.github Fixed workflows to not run twice unnecessarily 2020-02-02 11:17:11 +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
.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
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-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 Bump github.com/tidwall/redcon from 1.2.1 to 1.3.2 (#18) 2020-03-07 14:14:04 +10:00
go.sum Bump github.com/tidwall/redcon from 1.2.1 to 1.3.2 (#18) 2020-03-07 14:14:04 +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 Migrated to Github Actions 2020-02-01 22:48:39 +10:00
server.go Upgraded to bitcask v0.3.5 (#6) 2020-02-01 12:57:02 +00: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 [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)