How do I know when a slave and master are in sync

260 views
Skip to first unread message

David Montgomery

unread,
Mar 17, 2012, 5:25:50 AM3/17/12
to redi...@googlegroups.com
Hi,


In my fail over strategy...I have a remote monitor that is always
checking the heath of the master, slave, then I write to the master
and get the results from the slave to test for a sync....if all is
well then healthy.

I then simulate a master and slave crash in ec2. New slave or master
is brought up and all is well based on a heath check of the master or
the slave. But, this works in dev where I do not have a lot of keys
and things go quick. In production I will have about 300-400 million
keys.

Once a new slave is brought up and the process begins for syncing the
master to the slave, at what point can I write to master to test for a
sync?

My concern is this.

Once the process begins of syncing, my loop continues to test for
health. Do I have to wait for a full sync before I can write a test
set on the master to get a get on the slave? If so, then was is the
flag I should be looking for to wait for a success sync and to
continue on my merry way? I am using python.


Thanks

Salvatore Sanfilippo

unread,
Mar 17, 2012, 5:57:49 AM3/17/12
to redi...@googlegroups.com
Hello,

you should wait for the slave's INFO output to look like this:

master_link_status:up

Salvatore


--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To post to this group, send email to redi...@googlegroups.com.
To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.




--
Salvatore 'antirez' Sanfilippo
open source developer - VMware

http://invece.org
"We are what we repeatedly do. Excellence, therefore, is not an act, but a habit." -- Aristotele

Josiah Carlson

unread,
Mar 17, 2012, 4:31:40 PM3/17/12
to redi...@googlegroups.com
If you also want to ensure that data on your master is also on your
slave, pick a random key and value, write it to the master, then try
to read it from the slave. If you are able to read it from the slave,
you are at least synced up to the point that you wrote that value to
the master. If it is not there, then your slave is lagging a bit, you
should wait and try again.

Regards,
- Josiah

Salvatore Sanfilippo

unread,
Mar 18, 2012, 5:40:52 PM3/18/12
to redi...@googlegroups.com
On Sat, Mar 17, 2012 at 9:31 PM, Josiah Carlson <josiah....@gmail.com> wrote:
If you also want to ensure that data on your master is also on your
slave, pick a random key and value, write it to the master, then try
to read it from the slave. If you are able to read it from the slave,
you are at least synced up to the point that you wrote that value to
the master. If it is not there, then your slave is lagging a bit, you
should wait and try again.


There is also DEBUG DIGEST (warning, a blocking SLOW operation) if you want to check that data set of two instances is the same, if you suspect there is some weird desync.

Salvatore
Reply all
Reply to author
Forward
0 new messages