0
votes

I have a redis setup with sentinels and multiple slaves, each slave as well as the master writes persistently to a snapshot file.

When I restart the system, every slave has more keys in their instance than the master has (but less keys than are present in their snapshot file), and I do not understand why?

1) My question, does a slave ever read the snapshot file at startup or it only synch with the master?

2) I never copy my snapshot files, does this lead to overwrite problems?

3) If I have keys with EXPIRATION, are those removed form the snapshot file at the corresponding time?

1

1 Answers

4
votes

1) My question, does a slave ever read the snapshot file at startup or it only synch with the master?

When a slave restarts, it loads snapshot(RDB) file from disk if there's no AOF file.

2) I never copy my snapshot files, does this lead to overwrite problems?

It has nothing to do with copying.

3) If I have keys with EXPIRATION, are those removed form the snapshot file at the corresponding time?

When Redis loads the RDB file, if a key has expiration, Redis will add the key value to dict and set expiration for that key. No matter whether the key has already expired (the key will be removed later).

When I restart the system, every slave has more keys in their instance than the master has

The slaves might NOT full sync with the master before they are shutdown, and some keys have been deleted from the master. After re-syncing with the master, those keys will be deleted from slaves.