Basic Raft Implementation

598 views
Skip to first unread message

sateesh bangaru giri

unread,
Aug 28, 2019, 12:41:31 AM8/28/19
to raft-dev
how to start implementing basics raft consensus algorithm in java??can anyone help  me out?

Keine Neco

unread,
Aug 28, 2019, 1:32:10 AM8/28/19
to raft...@googlegroups.com
Well, it is really a short question. You can implement a Raft based on the paper, just implement some Grpc and AE, RV, and it works.
Or you can take a look on this repo.

sateesh bangaru giri <satt...@gmail.com> 于2019年8月28日周三 下午12:41写道:
how to start implementing basics raft consensus algorithm in java??can anyone help  me out?

--
You received this message because you are subscribed to the Google Groups "raft-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to raft-dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/raft-dev/bbd880d8-03a3-4ef9-9041-d062c9602e8d%40googlegroups.com.

sateesh bangaru giri

unread,
Aug 28, 2019, 1:51:19 AM8/28/19
to raft-dev
I need it in english?


On Wednesday, August 28, 2019 at 11:02:10 AM UTC+5:30, Keine Neco wrote:
Well, it is really a short question. You can implement a Raft based on the paper, just implement some Grpc and AE, RV, and it works.
Or you can take a look on this repo.

sateesh bangaru giri <satt...@gmail.com> 于2019年8月28日周三 下午12:41写道:
how to start implementing basics raft consensus algorithm in java??can anyone help  me out?

--
You received this message because you are subscribed to the Google Groups "raft-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to raft...@googlegroups.com.

jordan.h...@gmail.com

unread,
Aug 28, 2019, 2:09:17 AM8/28/19
to raft...@googlegroups.com
I think it’s far too broad a question. And we can’t provide a better answer than the Raft paper/dissertation can. The algorithm is well specified there and in the formal model, and implementing it is just a matter of implementing the protocol in your desired language.

The more mature Raft implementations (like the one linked above) include a lot of code that’s irrelevant to understanding the algorithm but relevant to making it work in production environments. I’d suggest finding a more minimal Java implementation instead and studying that first.
To unsubscribe from this group and stop receiving emails from it, send an email to raft-dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/raft-dev/aa7079bb-5395-400f-9492-8840298859ba%40googlegroups.com.

김현준

unread,
Aug 28, 2019, 2:54:34 AM8/28/19
to raft-dev
Last month, I struggled to implement raft algorithm with java, 
I read paper and other java-raft implementations in github. 
First, you should watch raft algorithm animation provided in raft.io website.
Second, read raft algorithm paper
Third, finds out some raft algorithm implements in github.

But, As Jordan Halterman already mentioned, If you write raft algorithm implementation, You may need to spend way more time for studying other topics that are not directly relevant with raft algorithm( Last month, I started to my raft-java implementation project. To make minimum viable raft-algorithm, But after I think that, Oh, I figured out how to implement raft algorithm now. 
However what I really had to do is not coding raft-algorithm, those were protobuf(for gRPC), statemachine , async programming ( lock , 'future' , 'pool' , thread'  in java )  concept and practices ,
 fileIO(For logging which raft algorithm requires) ,RPC(gRPC), shell script, It was really difficult to me. But now, I think it's really helpful to improve my programming skills), 

Projects I had refer

https://github.com/wenweihu86/raft-java  [ This is great example, But the author use his own RPC library
(Technically, which is Baidu's RPC libary, Anyway. I prefer google's project to baidu's , I just learned what methods does raft algorithm are supposed to make and details of the methods.

As  
As Keine Neco mentioned, sofa-jraft is great project. 
But IMHO, It's code base is to big to catch the core of raft algorithm to me. 
So, my recommendation is 'raft-java' project and go to 3 or further page in github repository list of raft algorithm 
filtered with 'java language' and get something legitimate project!


2019년 8월 28일 수요일 오후 1시 41분 31초 UTC+9, sateesh bangaru giri 님의 말:

Ken Horn

unread,
Aug 28, 2019, 5:39:19 AM8/28/19
to raft...@googlegroups.com
You could start with this test suite, https://github.com/jepsen-io/maelstrom , and the demo implementation within.

--
You received this message because you are subscribed to the Google Groups "raft-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to raft-dev+u...@googlegroups.com.

Priyanshu Sharma

unread,
Aug 9, 2020, 6:16:34 AM8/9/20
to raft-dev
Before you try implementing Raft, you should make sure that you know how to work in multi-threaded/asynchronous environment. I personally liked Jenkov's Java concurrency and multithreading tutorial. You should also know how to perform Rpc in java. You can try RMI or gRpc. I found gRpc really comfortable to work with once I understood it. If you already know about this and still struggling, you should look at other repositories. https://eli.thegreenplace.net/2020/implementing-raft-part-0-introduction/ This one is written in Go but the author explains his code and his approach so I found it really helpful while implementing it myself. For java implementations, you should refer to https://raft.github.io/. Hope it helped.

hw ding

unread,
Aug 9, 2020, 11:36:59 PM8/9/20
to raft-dev
You can check out my demo: rafty-kv
Not the best but it worked minimally.
Reply all
Reply to author
Forward
0 new messages