All Projects → xnnyygn → Xraft

xnnyygn / Xraft

Licence: mit
xnnyygn's raft implementation

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Xraft

Raft
Raft Consensus Algorithm
Stars: ✭ 370 (+273.74%)
Mutual labels:  raft, distributed-systems
Pysyncobj
A library for replicating your python class between multiple servers, based on raft protocol
Stars: ✭ 468 (+372.73%)
Mutual labels:  raft, distributed-systems
Odin
A programmable, observable and distributed job orchestration system.
Stars: ✭ 405 (+309.09%)
Mutual labels:  raft, distributed-systems
kerala
Distributed KV Streams
Stars: ✭ 16 (-83.84%)
Mutual labels:  distributed-systems, raft
Kingbus
A distributed MySQL binlog storage system built on Raft
Stars: ✭ 798 (+706.06%)
Mutual labels:  raft, distributed-systems
Dragonboat
Dragonboat is a high performance multi-group Raft consensus library in pure Go.
Stars: ✭ 3,983 (+3923.23%)
Mutual labels:  raft, distributed-systems
Elasticell
Elastic Key-Value Storage With Strong Consistency and Reliability
Stars: ✭ 453 (+357.58%)
Mutual labels:  raft, distributed-systems
MIT6.824-2021
4 labs + 2 challenges + 4 docs
Stars: ✭ 594 (+500%)
Mutual labels:  distributed-systems, raft
Hraftd
A reference use of Hashicorp's Raft implementation
Stars: ✭ 732 (+639.39%)
Mutual labels:  raft, distributed-systems
Copycat
A novel implementation of the Raft consensus algorithm
Stars: ✭ 551 (+456.57%)
Mutual labels:  raft, distributed-systems
Kites
🪁 A consistency, partition tolerance completed distributed KV store, implementation of the Raft distributed consensus protocol and Kotlin.
Stars: ✭ 41 (-58.59%)
Mutual labels:  distributed-systems, raft
Rqlite
The lightweight, distributed relational database built on SQLite
Stars: ✭ 9,147 (+9139.39%)
Mutual labels:  raft, distributed-systems
coolbeans
Coolbeans is a distributed work queue that implements the beanstalkd protocol.
Stars: ✭ 56 (-43.43%)
Mutual labels:  distributed-systems, raft
Raft
An Elixir implementation of the raft consensus protocol
Stars: ✭ 369 (+272.73%)
Mutual labels:  raft, distributed-systems
golearn
🔥 Golang basics and actual-combat (including: crawler, distributed-systems, data-analysis, redis, etcd, raft, crontab-task)
Stars: ✭ 36 (-63.64%)
Mutual labels:  distributed-systems, raft
Nuraft
C++ implementation of Raft core logic as a replication library
Stars: ✭ 428 (+332.32%)
Mutual labels:  raft, distributed-systems
little-raft
The lightest distributed consensus library. Run your own replicated state machine! ❤️
Stars: ✭ 316 (+219.19%)
Mutual labels:  distributed-systems, raft
huffleraft
Replicated key-value store driven by the raft consensus protocol 🚵
Stars: ✭ 32 (-67.68%)
Mutual labels:  distributed-systems, raft
Ra
A Raft implementation for Erlang and Elixir that strives to be efficient and make it easier to use multiple Raft clusters in a single system.
Stars: ✭ 478 (+382.83%)
Mutual labels:  raft, distributed-systems
Blog
my blog, using markdown
Stars: ✭ 25 (-74.75%)
Mutual labels:  raft, distributed-systems

xraft

A raft implementation of XnnYygn's.

I want to make something with netty framework, and I found raft. Raft is interesting. As the first distributed consensus algorithm I learnt, I read the paper and implemented almost all of the feature of raft including

  • Leader election and log replication
  • Membership change(one server change)
  • Log compaction

All these feature are implemented in xraft-core. And the client interaction in raft, I thought, should be the feature of service based on xraft-core. Until now, I made a simple key value store based on xraft-core, called xraft-kvstore. It supports GET and SET command.

Demostration

To test xraft with xraft-kvstore, you can download xraft and run xraft-kvstore, xraft-kvstore-cli.

Prerequistes

Java 1.8+ is required to run xraft. You can run java -version to check the version of java on your computer.

Download

You can get complied xraft in releases.

Run Server

xraft-kvstore under the bin directory is the command to run xraft kvstore server.

To demostrate a xraft cluster with 3 nodes(memory log mode),

  • node A, host localhost, port raft node 2333, port kvstore 3333
  • node B, host localhost, port raft node 2334, port kvstore 3334
  • node C, host localhost, port raft node 2335, port kvstore 3335

start servers with commands below

Terminal A

$ bin/xraft-kvstore -gc A,localhost,2333 B,localhost,2334 C,localhost,2335 -m group-member -i A -p2 3333

Terminal B

$ bin/xraft-kvstore -gc A,localhost,2333 B,localhost,2334 C,localhost,2335 -m group-member -i B -p2 3334

Terminal C

$ bin/xraft-kvstore -gc A,localhost,2333 B,localhost,2334 C,localhost,2335 -m group-member -i C -p2 3335

Since the minimum election timeout is 3 seconds, if you cannot execute all 3 commands within 3 seconds, you will get some error like failed to connect ..... But after you started all nodes, the error will disapper.

After start, you will see something like become leader, current leader is xxx and it shows the cluster is started and leader election is ok.

Run Client

Run xraft-kvstore-cli with the cluster configuration. The client will not connect to any node in cluster so it is ok to run client before cluster starts.

$ bin/xraft-kvstore-cli -gc A,localhost,3333 B,localhost,3334 C,localhost,3335

It will run an interative console, press TAB two times and you will get the available commands. For this demostration, firstly run

> kvstore-get x

and you should get the result null. Then run

> kvstore-set x 1

nothing will be printed, now you can run get again.

> kvstore-get x

1 should be printed.

New Service

How to create new service based on xraft-core?

For more detailed implementation of new service, see the source code of xraft-kvstore.

Build

xraft use Maven as build system.

$ mvn clean compile install

To package xraft-kvstore

$ cd xraft-kvstore
$ mvn package assembly:single

License

This project is licensed under the MIT License.

关于《分布式一致性算法开发实战》和相关讨论

2020年5月,我出版了一本书,名字叫做《分布式一致性算法开发实战》。书里面大部分代码都是参考我的这个项目,或者说我是先完成了这个项目然后再写了书。如果你对项目本身的架构,设计选择或者算法本身等有兴趣的话,欢迎阅读《分布式一致性算法开发实战》,我在书里做了很多详细的讲解。

另外,如果你对书籍或者代码设计有疑问的话,或者想要交流的话,欢迎在豆瓣页面的讨论区内发表话题,我会定期检查并回复。

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].