KeyDB icon indicating copy to clipboard operation
KeyDB copied to clipboard

master create rdb file after replica restarted and want to sync

Open artarik opened this issue 2 years ago • 3 comments

Hello i have a keydb cluster consist of master node, slave node both managed by sentinel node. config files in attach. Everything work in docker. version of keydb 6.2.2 i don't use rdb file everything stored in appendonly.aof, but if i restart slave, master create dump_keydb.rdb file the same size as aof file which not delete after replication and sometimes i get error out of space, because my aof file can be more than 50% of disk size how i can disable creating rdb file? also i don't understand why i see this entry: 5244:5244:S 22 Apr 2022 14:54:00.054 * Reading RDB preamble from AOF file... i thinked that it works with redis param aof-use-rdb-preamble yes but i haven`t it in my config file. master logs

127:278:M 22 Apr 2022 14:54:00.981 * Replica 10.22.0.128:6379 asks for synchronization
127:278:M 22 Apr 2022 14:54:00.981 * Partial resynchronization not accepted: Replication ID mismatch (Replica asked for '284fc8a2424da9f9e8b0d4ac7cc5851b753ca46d', my replication IDs are '136628b0dd3dd1108b7c8c4189c4e855d96c93db' and 'dee1cf00c5dcf5eaaf280b7dc19eae34fc9c2965')
127:278:M 22 Apr 2022 14:54:00.981 * Starting BGSAVE for SYNC with target: disk
127:278:M 22 Apr 2022 14:54:00.986 * Background saving started by pid 9298
9298:278:C 22 Apr 2022 14:54:03.338 * DB saved on disk
9298:278:C 22 Apr 2022 14:54:03.341 * RDB: 1 MB of memory used by copy-on-write
127:278:M 22 Apr 2022 14:54:03.356 * Background saving terminated with success
127:278:M 22 Apr 2022 14:54:04.624 * Synchronization with replica 10.22.0.128:6379 succeeded

slave logs

5244:5244:C 22 Apr 2022 14:54:00.051 * Before turning into a replica, using my own master parameters to synthesize a cached master: I may be able to synchronize with the new master with just a partial transfer.
5244:5244:C 22 Apr 2022 14:54:00.051 # oO0OoO0OoO0Oo KeyDB is starting oO0OoO0OoO0Oo
5244:5244:C 22 Apr 2022 14:54:00.052 # KeyDB version=6.2.2, bits=64, commit=00000000, modified=0, pid=5244, just started
5244:5244:C 22 Apr 2022 14:54:00.052 # Configuration loaded
5244:5244:S 22 Apr 2022 14:54:00.053 * monotonic clock: POSIX clock_gettime
5244:5244:S 22 Apr 2022 14:54:00.053 * Running mode=standalone, port=6379.
5244:5244:S 22 Apr 2022 14:54:00.053 # Server initialized
5244:5244:S 22 Apr 2022 14:54:00.054 * Reading RDB preamble from AOF file...
5244:5244:S 22 Apr 2022 14:54:00.054 * Loading RDB produced by version 6.2.2
5244:5244:S 22 Apr 2022 14:54:00.054 * RDB age 1492 seconds
5244:5244:S 22 Apr 2022 14:54:00.054 * RDB memory usage when created 287.67 Mb
5244:5244:S 22 Apr 2022 14:54:00.054 * RDB has an AOF tail
5244:5244:S 22 Apr 2022 14:54:00.977 # Done loading RDB, keys loaded: 561607, keys expired: 0.
5244:5244:S 22 Apr 2022 14:54:00.977 * Reading the remaining AOF tail...
5244:5244:S 22 Apr 2022 14:54:00.977 * DB loaded from append only file: 0.924 seconds
5244:5386:S 22 Apr 2022 14:54:00.978 * Thread 0 alive.
5244:5387:S 22 Apr 2022 14:54:00.978 * Thread 1 alive.
5244:5386:S 22 Apr 2022 14:54:00.978 * Connecting to MASTER 10.22.0.203:6379
5244:5386:S 22 Apr 2022 14:54:00.978 * MASTER <-> REPLICA sync started
5244:5386:S 22 Apr 2022 14:54:00.979 * Non blocking connect for SYNC fired the event.
5244:5386:S 22 Apr 2022 14:54:00.979 * Master replied to PING, replication can continue...
5244:5386:S 22 Apr 2022 14:54:00.981 * Trying a partial resynchronization (request 284fc8a2424da9f9e8b0d4ac7cc5851b753ca46d:1).
5244:5386:S 22 Apr 2022 14:54:00.986 * Full resync from master: 136628b0dd3dd1108b7c8c4189c4e855d96c93db:1443613
5244:5386:S 22 Apr 2022 14:54:00.986 * Discarding previously cached master state.
5244:5386:S 22 Apr 2022 14:54:03.357 * MASTER <-> REPLICA sync: receiving 131025873 bytes from master to disk
5244:5386:S 22 Apr 2022 14:54:04.635 * MASTER <-> REPLICA sync: Flushing old data
5244:5386:S 22 Apr 2022 14:54:05.727 * MASTER <-> REPLICA sync: Loading DB in memory
5244:5386:S 22 Apr 2022 14:54:05.743 * Loading RDB produced by version 6.2.2
5244:5386:S 22 Apr 2022 14:54:05.743 * RDB age 5 seconds
5244:5386:S 22 Apr 2022 14:54:05.743 * RDB memory usage when created 1199.63 Mb
5244:5386:S 22 Apr 2022 14:54:06.705 # Done loading RDB, keys loaded: 561607, keys expired: 0.
5244:5386:S 22 Apr 2022 14:54:06.705 * MASTER <-> REPLICA sync: Finished with success

keydb1.txt keydb2.txt

artarik avatar Apr 22 '22 15:04 artarik

Hi @artarik,

Sorry for the late response.

  1. You can disable RDB files being saved by using the config save "", which would remove background RDB saves entirely.
  2. The default option for aof-use-rdb-preamble is yes if no configs are specified.

VivekSainiEQ avatar May 16 '22 14:05 VivekSainiEQ

You can disable RDB files being saved by using the config save "", which would remove background RDB saves entirely.

i disable it in my config file ( see last line in attached keydb*.txt files)

artarik avatar May 23 '22 11:05 artarik

For a full sync the master would create a temp rdb file for the replica to load. Try diskless replication to avoid this. See more here: https://github.com/Snapchat/KeyDB/blob/2c38667ecf49f6569268f5c1986e4c47564f47ac/keydb.conf#L559

benschermel avatar Jun 06 '22 04:06 benschermel