redis "cluster failover" command

949 views
Skip to first unread message

Sumo

unread,
Apr 22, 2014, 9:29:52 AM4/22/14
to redi...@googlegroups.com
A manual failover doesn't works if the Master is down (see below), however the error message tells me to use "cluster failover force" instead but it seems that this command option is not implemented yet?

linux:~/cluster # redis-cli -p 7000 -h 192.168.0.68 -c cluster nodes | sort -k2
03f350baf80b0a8198f8d07af766349970a7779b 192.168.0.68:7001 slave 8f5fd34ed2d717236edcb25d3c253c16933556a3 0 1398172944636 4 connected
ff9b59994449e7b463b5aaf8fa05e292d4ac09c7 192.168.0.68:7002 slave 0d451781d1fc8e2f6a97ba27b69397dd790a291d 0 1398172944636 5 connected
0d451781d1fc8e2f6a97ba27b69397dd790a291d 192.168.0.69:7000 master,fail? - 1398172334856 1398172334554 5 disconnected 0-4095
fa2584f59dd4f33cb0abe9ffbff5d14e995473f0 192.168.0.69:7001 slave,fail? 6c10bbcafd50b6088d0a9abc097503d152fd6f64 1398172334856 1398172334655 7 disconnected
9a70bcae166af8a6cbecfc71468ff07d24a14c6f 192.168.0.69:7002 slave,fail? 512e83ef121b50341e038c90c791f83470755572 1398172334754 1398172334655 6 disconnected
8f5fd34ed2d717236edcb25d3c253c16933556a3 192.168.0.70:7000 master,fail? - 1398172334855 1398172334554 4 disconnected 12288-16383
45d61f103e79bb15e094678551b29cf48cab85eb 192.168.0.70:7001 slave,fail? 512e83ef121b50341e038c90c791f83470755572 1398172334958 1398172334755 6 disconnected
31a551da243442bbbe323bd35d9c55a06b3a5d5c 192.168.0.70:7002 slave,fail? 0d451781d1fc8e2f6a97ba27b69397dd790a291d 1398172334856 1398172334755 5 disconnected
512e83ef121b50341e038c90c791f83470755572 192.168.0.71:7000 master - 0 1398172944634 6 connected 4096-8191
3b99bdc6023cdfa031cc2899f78e681771a4663a 192.168.0.71:7001 slave 6c10bbcafd50b6088d0a9abc097503d152fd6f64 0 1398172944738 7 connected
81eb016e1a3d4b7b291421d26096cdced5b8fec8 192.168.0.71:7002 slave 8f5fd34ed2d717236edcb25d3c253c16933556a3 0 1398172944636 4 connected
6c10bbcafd50b6088d0a9abc097503d152fd6f64 :0 myself,master - 0 0 7 connected 8192-12287

linux:~/cluster # redis-cli -p 7000 -h 192.168.0.68 -c cluster nodes | sort -k2 | grep master
0d451781d1fc8e2f6a97ba27b69397dd790a291d 192.168.0.69:7000 master,fail? - 1398172334856 1398172334554 5 disconnected 0-4095
8f5fd34ed2d717236edcb25d3c253c16933556a3 192.168.0.70:7000 master,fail? - 1398172334855 1398172334554 4 disconnected 12288-16383
512e83ef121b50341e038c90c791f83470755572 192.168.0.71:7000 master - 0 1398172965031 6 connected 4096-8191
6c10bbcafd50b6088d0a9abc097503d152fd6f64 :0 myself,master - 0 0 7 connected 8192-12287

linux:~/cluster # redis-cli -p 7001 -h 192.168.0.68 -c
192.168.0.68:7001> cluster failover
(error) ERR Master is down or failed, please use CLUSTER FAILOVER FORCE
192.168.0.68:7001> cluster failover force
(error) ERR Wrong CLUSTER subcommand or number of arguments
-> Redirected to slot [12182] located at 192.168.0.68:7000
(nil)
(nil)
-> Redirected to slot [5649] located at 192.168.0.71:7000
(nil)
-> Redirected to slot [1584] located at 192.168.0.69:7000
Could not connect to Redis at 192.168.0.69:7000: Connection refused
Could not connect to Redis at 192.168.0.69:7000: Connection refused
not connected> get 3
Could not connect to Redis at 192.168.0.69:7000: Connection refused
not connected>

From cluster.c:
 } else if (!strcasecmp(c->argv[1]->ptr,"failover") && c->argc == 2) {
        if (nodeIsMaster(myself)) {
            addReplyError(c,"You should send CLUSTER FAILOVER to a slave");
            return;
        } else if (myself->slaveof == NULL || nodeFailed(myself->slaveof) ||
                   myself->slaveof->link == NULL)
        {
            addReplyError(c,"Master is down or failed, "
                            "please use CLUSTER FAILOVER FORCE");
            return;
        }
        resetManualFailover();
        server.cluster->mf_end = mstime() + REDIS_CLUSTER_MF_TIMEOUT;
        clusterSendMFStart(myself->slaveof);
        redisLog(REDIS_WARNING,"Manual failover user request accepted.");
        addReply(c,shared.ok);
    } else {

Thanks,
Sumo

Salvatore Sanfilippo

unread,
Apr 22, 2014, 10:19:22 AM4/22/14
to Redis DB
Hello, yes the "FORCE" option is a work in progress and will be
available in the next weeks.
With FORCE all the usual checks will be skipped and the promotion will
happen anyway.
It will be available in the next weeks (it is in the beta-3 TODO list actually).

Regards,
Salvatore
> --
> You received this message because you are subscribed to the Google Groups
> "Redis DB" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to redis-db+u...@googlegroups.com.
> To post to this group, send email to redi...@googlegroups.com.
> Visit this group at http://groups.google.com/group/redis-db.
> For more options, visit https://groups.google.com/d/optout.



--
Salvatore 'antirez' Sanfilippo
open source developer - GoPivotal
http://invece.org

To "attack a straw man" is to create the illusion of having refuted a
proposition by replacing it with a superficially similar yet
unequivalent proposition (the "straw man"), and to refute it
— Wikipedia (Straw man page)

Salvatore Sanfilippo

unread,
May 12, 2014, 12:14:54 PM5/12/14
to Redis DB
Hello, an update about this, CLUSTER FAILOVER FORCE is now implemented
in the unstable branch of Redis.

Salvatore

On Tue, Apr 22, 2014 at 3:29 PM, Sumo <king...@gmail.com> wrote:

Sumo

unread,
May 16, 2014, 3:28:49 PM5/16/14
to redi...@googlegroups.com
Thanks! I'm going to test this next week :)
Reply all
Reply to author
Forward
0 new messages