(Remind) MySQL Master-slave replication
MySQL The master-slave replication mode supported by the database is as follows ：
Asynchronous replication （Asynchronous replication）
MySQL The default replication is asynchronous , The main database will return the result to the client immediately after executing the transaction submitted by the client , It doesn't matter whether the slave library has been accepted and processed . There will be a problem , If the main database is down , Data loss .
Full synchronous replication （Fully synchronous replication）
When the master library completes a transaction , All the slave libraries execute the transaction before it is returned to the client . Because you need to wait for all the slave libraries to execute the object before returning , So the performance of full synchronous replication will be seriously affected .
Semi-synchronous replication （Semisynchronous replication）
Between asynchronous replication and full synchronization , The main library does not return to the client immediately after executing a transaction committed by the client , Instead, wait for at least one to receive from the library and write to relay log Is returned to the client . As opposed to asynchronous replication , Semi-synchronous replication improves data security .
The advantages of master-slave replication - Read / write separation
Through the separation of read and write operations , Can achieve server load balancing , Improve the concurrent access ability of database
- Read write separation has a certain delay problem when reading data
- Read write separation is very suitable for querying database operations frequently
The advantages of master-slave replication - Remote backup
The advantages of master-slave replication - Disaster fault
When there is a problem with the master database , The database administrator can immediately replace the master database with the slave database , Fast recovery of system services
Redis Master slave replication concept
- Redis Support master-slave replication , It also supports one master multi-slave and multi-level slave structures （ And MySQL equally ）
- Redis Master slave replication one is for pure redundant backup , The second is to improve the reading performance （ Read / write separation ）
- Redis Master slave replication is asynchronous （ Master slave synchronization does not affect the master logic , It will not decrease Redis Processing performance of ）
- The production side turns off the persistence function of the primary server , Only make the slave server persistent （ Improve the processing performance of the master server ）
- Production is generally set from the server to only mode （ Avoid data errors from the server
Redis Master slave copy flow chart
本文为[Irving the procedural ape]所创，转载请带上原文链接，感谢