Slave status printed with INFO command

454 views
Skip to first unread message

Daniel Mezzatto

unread,
May 18, 2012, 5:31:56 PM5/18/12
to redi...@googlegroups.com
I did a simple test: two redis instances at the same machine. One is slave and the other is master.

If I send the INFO command to the Master, I get the following:

slave0:127.0.0.1,37479,online

Then, I froze the slave process (with "kill -STOP <pid>") and waited a LONG time, like 15 minutes.

The INFO command on the Master redis-server was still showing "online".

I have noticed that there is no way for me to know if the master redis-server thinks that the slave redis-server is up or down, since the INFO string fills the status lik this:

switch(slave->replstate) {
                case REDIS_REPL_WAIT_BGSAVE_START:
                case REDIS_REPL_WAIT_BGSAVE_END:
                    state = "wait_bgsave";
                    break;
                case REDIS_REPL_SEND_BULK:
                    state = "send_bulk";
                    break;
                case REDIS_REPL_ONLINE:
                    state = "online";
                    break;
                }

Am I missing something? Is there a way to know if the Master detected that the Slave is down other then the INFO output?

alex

unread,
May 25, 2012, 8:00:16 AM5/25/12
to redi...@googlegroups.com
Because after you KILL the slave instance, there was no sysn operation between Master and Slave instance.
if you do some update/set operation on master,  this will trigger an exception when writing the replication info to slave on master. and the client wil be remove from the server's client list.

在 2012年5月19日星期六UTC+8上午5时31分56秒,Daniel Mezzatto写道:
Reply all
Reply to author
Forward
0 new messages