Distributed Storage Four: Create a replication group

Recent work need to reach something Raft relevant, the following simple finishing points:

Internal Raft related interfaces

Has its own transaction log management interface: Supports append / get / truncate and other operations;

Separate log synchronization module: Replicator back one by one from the probe to determine the position and the main log is bifurcated, and then pulling node Follower missing log entries from the main, to the synchronization Follower, which is usually independent threads do;

There may be internal Raft Cache function only when the contents of log entries exceeds a certain length of time to be written, and then will real pleasure under the plate;

When synchronization logs, inside Raft checks whether the index ID and the destination node matches: Expected follower should ensure equal current index id + 1 and append over LOG index ID;

Replication Group creation process

1. The master node randomly find a storage node to create a copy of a copy of the group;

Check the number of replication group members (copies) of 2. After successfully reaches the agreed number of replication group members;

3. If not, the master node continues to randomly find a storage node to create a replication group members; if reached, to step 1 (a successful return to the master node)

  1. If the node successfully created a copy of the above, returns a copy to the master node is successfully created, the master node then send a request to add to the replication group members a copy of the first, in order to add the newly created copy of the replication group;

  2. Proceed to step 2

common problem

  1. Failure to resolve the transaction log

  2. Adding to the replication group member fails

  3. Leader of the replication group, there Follower, but there are no members in the Follower Leader

For Question 1: need to check out the load of logs is consistent with Raft and append a;
for the question 2,3: Leader did not usually due to configuration changes related to the synchronization log Follower, there may be kept down to read it before Leader configuration change log wrong, it may be to Follower nodes but was checked Raft index information thus failed internal request was rejected.

Guess you like

Origin blog.51cto.com/xiamachao/2448424