Preface the database structure of Master-Slave solves many problems, especially for applications with high readwrite performance. Structure 1: write operations are all performed on the Master
Preface The Master-Slave database mechanism solves many problems, especially for applications with high read/write values. Structure 1: write operations are all performed on the Master
Preface
The Master-Slave database mechanism solves many problems, especially for applications with high read/write performance.
1. All write operations are performed on the Master node, and the Slave database node regularly reads the bin-log of the Master node (60 s by default ).
2. distributed read requests from numerous users to more database nodes, reducing the pressure on single points of failure
Its disadvantage is:
1. Slave's real-time guarantee may require some processing for scenarios with high real-time performance.
2. high availability problem. The Master is the critical point (SPOF: Single point of failure)
This article mainly discusses how to solve the 2nd disadvantages.
The solution is as follows:
1. Use two MySQL master databases, master1 and master2, and the data is stored on the shared device. Use heartbeat2 for monitoring. When master1 fails, switch the resource to master2.
2. After a fault occurs, you do not need to modify the slave. The slave is automatically switched to master2. (Manual slave synchronization is required for power-off switching)