Is it possible to maintain dial consistency in Redis after a crash without AOF?

Relatively new to Redis.

Hypothetical setup / situation: suppose Redis takes a picture every 10 minutes. AOF is disabled. You have a collection called posts that stores the post IDs. You also have MySQL table storage tables.

  • There are only 2 mail identifiers in MySQL and Redis
  • Redis takes a picture
  • The user creates a new message - now Redis has 3 identifiers, and MySQL
  • But then Redis crashes or gets killed
  • After rebooting, Redis now has 2 identifiers, and MySQL has 3

Do you understand that Redis data is incompatible? From what I read, AOF introduces more problems and is not perfect. Is there a simpler / more elegant solution for preserving sets?

+4
source share
2 answers

How much data are we talking here? If this is not the case, you may have a process that simply reloads all the data in Redis from the MySQL database. The best part is that you can upload all of your data to Redis from the 10-minute backup storage, and then just overwrite all the keys with the key in Redis. If it already exists, then large, if not, then it adds it.

Unfortunately, you can never support them without any important work on creating concurrency between the two systems. AOF is not so bad. You must try. Even then you have to worry about consistency.

+2
source

One of the solutions I have been successful with is to use an instance of a slave server running on another server. Synchronization with slaves is not blocked, so it is likely that you will lose the last command or if the wizard works, but in practice this is unlikely. You can also have several slave devices for backup.

As a result, your wizard no longer uses ANY input / output disk and does not have additional memory for the process fork used by the snapshot. When the master goes down, you can restore the data by temporarily transferring one of your subordinates to the master (using my favorite redis command: SLAVEOF NO ONE ), having your main subordinate from your temporary master, and then restoring the master / subordinate roles to the original configurations upon completion synchronization.

+1
source

All Articles