mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 17:10:50 +00:00
Cluster: slave failover implemented.
This commit is contained in:
parent
1d8f302e0d
commit
44c92f5aeb
@ -1390,8 +1390,20 @@ void clusterHandleSlaveFailover(void) {
|
|||||||
if (server.cluster->failover_auth_count >= needed_quorum) {
|
if (server.cluster->failover_auth_count >= needed_quorum) {
|
||||||
redisLog(REDIS_WARNING,
|
redisLog(REDIS_WARNING,
|
||||||
"Masters quorum reached: failing over my (failing) master.");
|
"Masters quorum reached: failing over my (failing) master.");
|
||||||
/* TODO: Perform promotion. */
|
/* We have the quorum, perform all the steps to correctly promote
|
||||||
/* TODO: Broadcast update to cluster. */
|
* this slave to a master.
|
||||||
|
*
|
||||||
|
* 1) Turn this node into a master. */
|
||||||
|
clusterNodeRemoveSlave(server.cluster->myself->slaveof,
|
||||||
|
server.cluster->myself);
|
||||||
|
server.cluster->myself->flags &= ~REDIS_NODE_SLAVE;
|
||||||
|
server.cluster->myself->flags |= REDIS_NODE_MASTER;
|
||||||
|
server.cluster->myself->slaveof = NULL;
|
||||||
|
replicationUnsetMaster();
|
||||||
|
|
||||||
|
/* 2) Ping all the other nodes so that they can update the state
|
||||||
|
* accordingly and detect that we switched to master role. */
|
||||||
|
clusterBroadcastPing();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user