Coder Social home page Coder Social logo

zhangshuao / bitraft Goto Github PK

View Code? Open in Web Editor NEW

This project forked from carlvine500/bitraft

0.0 1.0 0.0 2.67 MB

๐ŸŽ‰A Bitcask Distributed Key/Value store using Raft for consensus with a Redis compatible API written in Go.

Home Page: https://prologic.github.io/bitraft

License: MIT License

Makefile 5.75% Go 89.09% Shell 3.76% Dockerfile 1.39%

bitraft's Introduction

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)

bitraft's People

Contributors

tidwall avatar prologic avatar muesli avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.