The database high-availability architecture is a strange field for those of us who develop applications. It is an environment built on a specific database product, you need to have enough knowledge of database products like DBA to get involved. Although you cannot go deep into it, you can learn the ideas through some classic high-availability architecture. I have learned the following:
- MySQL Replication
- MySQL Cluster
- Oracle RAC
- IBM hacmp
- Oracle ASM
MySQL Replication
MySQL replication improves availability by asynchronously copying multiple copies. The conventional replication architecture includes the following:
- Master-slaves
- Master-Master
- Master-master-salves
1) master-slaves
Master-slaves is the most commonly used method to improve availability. Especially in Internet applications, reading is far greater than writing. Therefore, improving read availability is the first of these methods, master-slaves enables write operations to be concentrated on a database master, and then the master will copy the update operations to other database slaves. All read operations occur on slaves, the architecture diagram is as follows:
For example, when slavec is unavailable, reading and writing will not be interrupted. After slavec is restored, it will automatically synchronize lost data and re-run the data. The maintainability is very good. However, if the master node has a problem, it will be troublesome. Therefore, it only solves the high availability of reading, but does not guarantee the high availability of writing. For more information about Master-slaves, see previous blog posts to build a high-performance web path ------ MySQL read/write splitting practice
2) master-Master
MySQL provides a master-master replication architecture to address the high availability of last-interview writing, as shown below:
Generally, data is written to the mascript. The mascript node automatically switches to the masterb node when there is a problem with the mascript node. When the mascript node recovers, the masterb node synchronizes data to the mascript node.
3) master-salves
Master-master-salves is a replication architecture that provides both read and write high availability, as shown in:
MySQL Cluster
MySQL cluster consists of three parts:
- SQL Server Node
- NDB data storage Node
- Monitoring and Management Nodes
Shows the structure of the three departments:
This layer is also related to the architecture in which MySQL separates SQL processing from storage. For the MySQL architecture, we can see the previous blog post design and development application server (I) ------ common mode
In this way, MySQL cluster can implement high-availability replication policies at the SQL processing and storage layers. At the SQL processing level, it is easier to create clusters because these SQL processes are stateless and can enhance availability by adding machines. At the storage level, the storage availability is increased by backing up each node, which is similar to MySQL replication. The structure is shown below:
Oracle RAC
Oracle RAC is similar to MySQL cluster, but it mainly focuses on the high availability of the SQL processing layer, but not much in storage. The structure is shown below:
Its primary advantage is its transparency to applications and high availability through heartbeat detection. Its primary disadvantage is that storage is shared and storage scalability is insufficient.
IBM hacmp
Similar to Oracle RAC, IBM hacmp is mainly used for dual-host mutual backup. The running process is as follows:
1) two servers (host a and host B) running in the hacmp environment simultaneously;
2) The server serves as the backup host of the other Party in addition to the applications running on the current host;
3) during the entire operation of the two host systems (A and B, monitor each other's running status through the heartbeat line (including system software and hardware running, network communication, and application running status );
4) Once the application on the faulty host is found to be abnormal (out of fault), the application on the faulty host will immediately stop running. This machine (backup machine of the faulty host) the application on the faulty machine will be started on the machine immediately, and the application and resources (including IP addresses and disk space used) of the faulty machine will be taken over, enable the applications on the faulty machine to continue running on the local machine;
5) The HA software automatically takes over applications and resources without manual intervention;
6) when the two hosts are working normally, you can manually switch the applications on one server to another (Backup Server) as needed.
Oracle ASM
Oracle ASM provides storage scalability. It achieves high availability through Automated Storage Management and backend scalable storage arrays. The structure is shown below:
Therefore, you can try to combine Oracle RAC and ASM to provide high availability of SQL processing and storage, which is also achieved by MySQL cluster.