I am writing a script to monitor redis replication latency in a group of redis slaves managed using sentinel. I am looking at the results of the INFO replication
command, which look like this:
# Replication
role:master
connected_slaves:5
slave0:ip=x.x.x.x,port=6379,state=online,offset=22246539656,lag=0
slave1:ip=y.y.y.y,port=6379,state=online,offset=22246538633,lag=1
slave2:ip=z.z.z.z,port=6379,state=online,offset=22247193804,lag=0
slave3:ip=n.n.n.n,port=6379,state=online,offset=22246538633,lag=1
slave4:ip=m.m.m.m,port=6379,state=online,offset=22244239193,lag=1
master_repl_offset:22246539199
repl_backlog_active:1
repl_backlog_size:536870912
repl_backlog_first_byte_offset:21709668288
repl_backlog_histlen:536870912
I had thought that the offset
for each slave was a measure of how much data had been replicated so far, so I could look at the difference between the master_repl_offset
and the offset
values for the various slaves to determine the amount of data not yet replicated. However, in the above output, the offsets for slave0
and slave2
are both higher than for the master. Have I misunderstood what these numbers mean?