Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
44c92f5a
Commit
44c92f5a
authored
Mar 15, 2013
by
antirez
Browse files
Cluster: slave failover implemented.
parent
1d8f302e
Changes
1
Show whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
44c92f5a
...
...
@@ -1390,8 +1390,20 @@ void clusterHandleSlaveFailover(void) {
if
(
server
.
cluster
->
failover_auth_count
>=
needed_quorum
)
{
redisLog
(
REDIS_WARNING
,
"Masters quorum reached: failing over my (failing) master."
);
/* TODO: Perform promotion. */
/* TODO: Broadcast update to cluster. */
/* We have the quorum, perform all the steps to correctly promote
* 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
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment