lolraft icon indicating copy to clipboard operation
lolraft copied to clipboard

HELP: how to run example with multi-nodes

Open KunPengRen opened this issue 2 years ago • 3 comments

Hi, I am interested in this project and try to run the example. Can you give me some introduction on how to run the example with multi-raft nodes.

KunPengRen avatar Jul 07 '22 13:07 KunPengRen

@KunPengRen integration-tests runs the kvs example to test the library. I think you can learn from this. In integration-tests, the test nodes are started on localhost but giving them normal IP addresses is also allowed. Actually, our team uses this library to deploy Raft applications in k8s cluster and normal virtual machines.

akiradeveloper avatar Jul 07 '22 14:07 akiradeveloper

It is a little hard for me to understand the integration-tests. From my understand, first, I run a raft node and keep this node ip+prot then, I use the API method api::AddServerReq and the first node id to run other nodes, but the management of the membership part is hard for me to understand. If you can provide a playground example that would be very appreciated. I am going to use this library in my project, it is not complex, just using raft for a persistent kv-store

KunPengRen avatar Jul 11 '22 16:07 KunPengRen

@KunPengRen

From my understand, first, I run a raft node and keep this node ip+prot then, I use the API method api::AddServerReq and the first node id to run other nodes, but the management of the membership part is hard for me to understand.

Did you read this document? The section "Cluster Management" explains it.

https://akiradeveloper.github.io/lol/

You needs to know some participant of the cluster to join a node. But how can the first node to join a cluster when there is no existing cluster? For the initial cluster, I use cluster bootstrapping.

This is an example of forming a cluster of 4 nodes (A,B,C,D)

  1. Commit AddServer(A) to A
  2. Commit AddServer(B) to A
  3. Commit AddServer(C) to A or B
  4. Commit AddServer(D) to A or B or C

akiradeveloper avatar Jul 12 '22 00:07 akiradeveloper