On Tue, Sep 18, 2012 at 10:49 PM, Pawel <
pawel....@gmail.com> wrote:
> Is it OK to wait until 'master_link_status' becomes 'up', and
> 'master_sync_in_progress' becomes '0' and 'master_last_io_seconds' becomes
>>= 0?
Hello, if you are interested to check if the first synchronisation
happened with success you should just check that master_link_status is
UP.
This means that the initial RDB was loaded from master.
This is probably a good enough strategy to also check if an already
synchronised slave is working ok, because if it is NOT receiving data,
it will disconnect for timeout and it will try to resync again.
However there are cases where the slave may receive some data but not
all as the speed at which we populate the Redis master is faster than
the master <-> slave link bandwidth. I never saw this thing reported
historically, but this may happen. When this happens in Redis 2.6, at
some point the master disconnects the replication link as we are using
too much buffers, as data can't be delivered as fast as needed, so
even in this case, eventually, the replication will be restarted.
However as suggested already in this thread, to check if a slave
already synched with the master is in pair with its data, the simplest
and more reliable way to do so is probably to PUBLISH something on the
server and check how much time it will take to replicate on the slave
(just subscribing on the slave side). In this way you can obtain the
"lag" between the two.
A different but related problem is to understand if we can trust a
slave after a master is gone. In such a case we no longer have
informations about the master dataset, but we can at least check the
master_link_down_since_seconds field in INFO to see if the slave
disconnected with the master no longer than X seconds ago, with X
chosen accordingly to our requirements.
Cheers,
Salvatore
--
Salvatore 'antirez' Sanfilippo
open source developer - VMware
http://invece.org
Beauty is more important in computing than anywhere else in technology
because software is so complicated. Beauty is the ultimate defence
against complexity.
— David Gelernter