Skip to content
yinqiwen edited this page May 11, 2016 · 7 revisions

Ardb replication is compatible with redis 2.6/2.8, so Ardb instance can be configured as a slave of a Redis instance and vice versa.

To disable Ardb replication set the following in ardb.conf

  1. set repo-backlog-size to zero.
  2. do not enable slaveof parameter.

Since redis 2.8 has new feature about 'partial replication', it's a little difference when ardb talking with Redis 2.6/2.8. The following would discuss the inner details about replication in ardb.

How it works

Ardb's replication design is based on redis 2.8 replication design, and have some changes to make it more reliable. Refer redis's replication topic for more details. The following would talking about the changes in ardb. http://redis.io/topics/replication

  1. The inner backlog buffer is mapping from a disk file. And the replication states(offsets, size, ...) are also mapping from a disk file. If master is restarted, master would resumed from last state.
  2. Master/Slave replication states are persisted periodically.
  3. Master would dump redis's rdb format file for redis slaves, dump ardb's format file for ardb slaves.

Master-Slave Sync

  • Master:Ardb Slave:Redis 2.6
    • Slave send 'sync' to master
    • Master mark slave as redis 2.6 slave, dump all data in a redis dump file, then send this file to slave.
    • After sending dump file, master mark slave's state as syncing from backlog buffer.
    • Master send caching data from the dumping offset. After sending cached data, master mark slave's state as ready. Then all commands changed data would be sent to this ready slave.
    • If slave reconnect master, it would send 'sync' again.
  • Master:Ardb Slave:Redis 2.8
    • Slave send psync <runid> offset to master
    • If the runid is unmatched current master or the offset is invalid, master would send FULLRESYNC <runid> offset to slave, or other wise master just send '+Continue' to slave.
    • If Master send '+Continue', then send cached data from offset in 'psync'.
    • If Master send FULLRESYNC <runid> offset, it would dump data to a file then send it to slave.
  • Master:Redis 2.6 Slave:Ardb
    • Refer 'Master:Ardb Slave Redis 2.6'
  • Master:Redis 2.8 Slave:Ardb
    • Refer 'Master:Ardb Slave:Redis 2.8'
  • Master:Ardb Slave:Ardb
    • Slave send psync <runid> offset cksm to master. (If master received 'psync' with 3 arguments, then the slave MUST be ardb instance.).
    • If the runid unmatch current master or the offset is invalid or checksum is unmatched, master would send FULLRESYNC <runid> offset cksm to slave, or other wise master just send '+Continue' to slave.
    • If Master send '+Continue', then send cached data from offset in 'apsync'.
    • If Master send 'FULLRESYNC offset cksm', it would iterate storage-engine and dump data to a file to send slave.
Clone this wiki locally