Giter Club home page Giter Club logo

eraft's Introduction

ERaftKV

⚠️ ERaftKV is still being developed, you can find a golang version for ebooks - Distributed Data Services at branch eraftbook

ERaftKV is a persistent distributed KV storage system, uses the Raft protocol to ensure data consistency, At the same time, it supports sharding for large-scale data storage.

ERaftKV Features

  • Strong and consistent data storage ensures secure and reliable data persistence in distributed systems.
  • Support KV data type operations, including PUT, GET, DEL, and SCAN operations on keys. When users operate on cluster data, they must ensure the persistence of the operation and the sequential consistency of reading and writing.
  • Dynamically configure the cluster, including adding and deleting nodes, adding and deleting cluster sharding configurations, including which keyrange the cluster sharding is responsible for.
  • Support for snapshot taking with the raft to compress and merge logs. During the snapshot, it is required to not block data read and write.
  • Support switching to a specifying leader.
  • Raft elections support PreVote, and newly added nodes do not participate in the election by tracking data to avoid triggering unnecessary elections.
  • Raft read optimization: adding a read queue ensures that the leader node returns a read request after submitting it, and unnecessary logs are not written.
  • Support data migration, multi-shard scale out.

Getting Started

Build

Execute follow build command on the machine with docker installed.

sudo make build-dev

Run demo in docker

  • step 1, create docker sub net
sudo make create-net

command output

docker network create --subnet=172.18.0.0/16 mytestnetwork
f57ad3d454f27f4b84efca3ce61bf4764bd30ce3d4971b85477daf05c6ae28a3
  • step 2, run cluster in shard mode
sudo make run-demo
  • step 3, use eraftkv-ctl to operator the cluster
add_group: ./eraftkv-ctl [metaserver addresses] add_group [groupid] [group server addresses]
remove_group: ./eraftkv-ctl [metaserver addresses] remove_group [group id] [node id]
query_groups: ./eraftkv-ctl [metaserver addresses] query_groups
set_slot: ./eraftkv-ctl [metaserver addresses] set_slot [groupid] [startSlot-endSlot]
put_kv: ./eraftkv-ctl [metaserver addresses] put_kv [key] [value]
get_kv: ./eraftkv-ctl [metaserver addresses] get_kv [key]

You can use follow command to run a basic rw bench test with ERaftKV

sudo make run-demo-test
  • step 4, clean all
sudo make stop-demo
sudo make rm-net

Building and run test using GitHub Actions

All you need to do is submit a Pull Request to our repository, and all compile, build, and testing will be automatically executed.

You can check the ERatfKVGitHubActions See the execution process of code build tests.

Building on your local machine.

To compile eraftkv, you will need:

  • Docker

To build:

make gen-protocol-code
make build-dev

Run test:

make tests

If you want to build image youtself

make image

Contributing

You can quickly participate in development by following the instructions in CONTROLUTING.md

eraft's People

Contributors

fenglin-zhou avatar liubiyongge avatar lliujj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

eraft's Issues

关于初始化Raft节点的问题

您好:
在阅读代码时遇到一个疑问:
raft.go代码初始化Raft节点时对该raft节点的日志进行了初始化:newraft.ReInitLog(),该初始化过程删除了所有日志,
raft论文中logs日志时持久化保存的,为什么在代码中每次启动都要清空日志呢?
而且清空日志后,接下来执行了如下代码
newraft.matchIdx[peer.id], newraft.nextIdx[peer.id] = 0, int(LastLogIndex)+1
这样每次matchidx和nextidx都为0和1了?
不理解为什么每次启动程序就要删除所有日志,而不是加载已经持久化的日志呢?

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.