Questions tagged [raft]

A distributed consensus protocol designed to be easy to understand. It's equivalent to Paxos in fault-tolerance and performance.

Click for source

Raft is a consensus algorithm that is designed to be easy to understand. It's equivalent to Paxos in fault-tolerance and performance. The difference is that it's decomposed into relatively independent subproblems, and it cleanly addresses all major pieces needed for practical systems. We hope Raft will make consensus available to a wider audience, and that this wider audience will be able to develop a variety of higher quality consensus-based systems than are available today.

Consensus is a fundamental problem in fault-tolerant distributed systems. Consensus involves multiple servers agreeing on values. Once they reach a decision on a value, that decision is final. Typical consensus algorithms make progress when any majority of their servers are available; for example, a cluster of 5 servers can continue to operate even if 2 servers fail. If more servers fail, they stop making progress (but will never return an incorrect result).

Consensus typically arises in the context of replicated state machines, a general approach to building fault-tolerant systems. Each server has a state machine and a log. The state machine is the component that we want to make fault-tolerant, such as a hash table. It will appear to clients that they are interacting with a single, reliable state machine, even if a minority of the servers in the cluster fail. Each state machine takes as input commands from its log. In our hash table example, the log would include commands like set x to 3. A consensus algorithm is used to agree on the commands in the servers' logs. The consensus algorithm must ensure that if any state machine applies set x to 3 as the nth command, no other state machine will ever apply a different nth command. As a result, each state machine processes the same series of commands and thus produces the same series of results and arrives at the same series of states.

259 questions
37
votes
7 answers

Conflict-free Replicated Data Types (CRDT) vs Paxos or Raft

When is it a good idea to use something like CRDT instead of paxos or raft?
Eric des Courtis
  • 5,135
  • 6
  • 24
  • 37
28
votes
3 answers

paxos vs raft for leader election

After reading paxos and raft paper, I have following confusion: paxos paper only describe consensus on single log entry, which is equivalent the leader election part of the raft algorithm. What's the advantage of paxos's approach over the simple…
Oliver Young
  • 578
  • 1
  • 4
  • 12
23
votes
3 answers

What is the difference between zookeeper and raft?

this is really dumb but what does zookeeper do that raft doesn't - not talking about zab but zookeeper itself. I get raft does leader election etc. w servers but what's the point of zookeeper? is there an analogy anyone has
18
votes
4 answers

How does the Raft algorithm guarantee consensus if there are multiple leaders?

As the paper says: Election Safety: at most one leader can be elected in a given term. §5.2 However, there may be more than one leader in the system. Raft only can promise that there is only one leader in a given term. So If I have more than one…
baotiao
  • 775
  • 6
  • 20
17
votes
1 answer

raft: committed entry may be lost?

What happens when leader crashes before all followers updates the commit index? For example, node A, B, C forms the cluster: only A and B alive and A is leader A replicates an entry (let's say it's entry1) to B and get successful result from B A…
kingluo
  • 1,679
  • 1
  • 13
  • 31
16
votes
1 answer

Raft Vs MongoDB Primary Election

How is the raft consensus algorithm different from MongoDB's primary election process other than the fact that MongoDB takes other factors (priority, for example) into consideration while electing the primary?
Chandra Sekar
  • 10,683
  • 3
  • 39
  • 54
9
votes
3 answers

Is operation in raft log entry supposed to be idempotent?

In raft, when a node restart, it try to redo all the log entries to catch up the state. But if node goes down again in recovery phase, node would do some op twice. These twice redo op will violate state machine if ops are not idempotent. According…
smxxqjl
  • 91
  • 4
9
votes
5 answers

How does raft handle committing entries from previous one?

In raft paper section 5.4.2 If a leader crashes before committing an entry, future leaders will attempt to finish replicating the entry. However, a leader cannot immediately conclude that an entry from a previous term is committed once it…
Jal
  • 2,174
  • 1
  • 18
  • 37
9
votes
1 answer

LMAX Replicator Design - How to support high availability?

LMAX Disruptor is generally implemented using the following approach: As in this example, Replicator is responsible for replicating the input events\commands to the slave nodes. Replicating across a set of nodes requires us to apply consensus…
coder_bro
  • 10,503
  • 13
  • 56
  • 88
8
votes
1 answer

Leader address/location in Raft

This may be a very simple question but I've not been able to find a good answer to this yet. Maybe someone can help me. Once a leader is elected - The clients will send all requests ONLY to the leader. Is this correct? Given that the location…
Soumya Simanta
  • 11,523
  • 24
  • 106
  • 161
7
votes
2 answers

How is ETCD a highly available system, even though it uses Raft which is a CP algorithm?

This is from Kubernetes documentation: Consistent and highly-available key value store used as Kubernetes' backing store for all cluster data. Does Kubernetes have a separate mechanism internally to make ETCD more available? or does ETCD use,…
7
votes
1 answer

How do nodes in a Raft cluster know what is the "majority"?

I am reading the the Raft paper and following the secret life of data visualisation and it seems that the majority is crucial in Raft, both for leader election as well as append entry requests. My question is how do the nodes know the total number…
spygi
  • 412
  • 3
  • 10
7
votes
2 answers

How do I practically use Raft algorithm

In the Raft paper, they mentioned that all the client interaction happens with the leader node. What I don't understand is that the leader keeps changing. So let's say my cluster is behind a load balancer. How do I notify the load balancer that the…
ffff
  • 2,853
  • 1
  • 25
  • 44
6
votes
2 answers

How does raft preserve safty when a leader commits a log entry and crashes before informing followers this commitment?

In my understanding, a leader sends AppendEntries RPC to the followers, and if majority of followers return success, the leader will commit this entry. It will commit this entry by applying it to its own state machine, and it will also return to the…
user534498
  • 3,926
  • 5
  • 27
  • 52
6
votes
1 answer

Could Raft elect a leader with uncommitted log?

Suppose a cluster of 5 nodes(ABCDE), node-A is elected leader at the beginning, and while leader-A issues AppendEntries RPCs to the follower(BCDE) to replicate log entry(log-X),only node-B receives and returns success, at this point leader-A…
Fiken
  • 63
  • 2
1
2 3
17 18