The combination of Redis and MySQL
At present, most Internet companies use MySQL as the main persistent storage of data, so how to make Redis and MySQL well together? We mainly use a MySQL as the main library, Redis as a high-speed data query from the library of heterogeneous read-write separation scheme.
For this purpose, we have developed our own MySQL replication tool, which makes it easy to synchronize data from MySQL to Redis in real time.
(Mysql-redis heterogeneous read-write separation)
Summarize:
- The Redis replication feature does not have incremental replication, and each time the re-connection sends the entire memory snapshot of the main library to the slave library, you need to avoid adding from the library to the more stressful main libraries on the online service.
- Redis replication is using snapshot persistence, so if your redis persistence option is log append (AOF), then it is possible for the system to do both the AOF log file and the snapshot write disk operation at the same time. The responsiveness of Redis will be affected at this time. So if you choose aof Persistence, you need to be more cautious about adding from the library.
- Redis cluster construction and online expansion can be done using active replication and presharding methods.
The combination of Redis and MySQL