2

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?

Aniket Schneider
  • 904
  • 1
  • 8
  • 21
  • Impossible unless slave0 and slave2 are time-travellers... or it may be a bug :) Which version did you use, or is this perhaps the `unstable` branch? – Itamar Haber Nov 21 '16 at 19:51
  • This set of instances is on 2.8.13 – Aniket Schneider Nov 21 '16 at 20:00
  • 2
    Hello, I think this is due to some bug in the 2.8 release. 2.8.13 is very old and a number of bugs were fixed. Moreover the replication code undergone different changes later in 3.0, 3.2, and is even more different in the upcoming Redis 4.0. I suggest to upgrade to the latest Redis 3.2. Note that Redis is backward compatible 99.99% (it is very very unlikely that you'll have any problem with your app upgrading). – antirez Nov 22 '16 at 08:09
  • 1
    p.s. now I also read "using Sentinel". Note that Redis Sentinel does not work very well against Redis 2.8 because it does not offer enough features for Sentinel to do the best work it can do. – antirez Nov 22 '16 at 08:13
  • 1
    Final note: in case you can reproduce this with 3.2.x, please ping us! – antirez Nov 22 '16 at 08:15

0 Answers0