The database high-availability architecture is a relatively unfamiliar area for those of us who develop these applications, and it is an environment built on specific database products that requires sufficient knowledge of database products like DBAs to be involved, though not in depth, but can be learned through some classic high-availability architectures. As far as I know, there are the following types:
- MySQL Replication
- MySQL Cluster
- Oracle RAC
- IBM HACMP
- Oracle ASM
MySQL Replication
MySQL replication is the purpose of improving usability by replicating multiple copies asynchronously, with the following general replication architectures:
- Master-slaves
- Master-master
- Master-master-salves
1) master-slaves
Master-slaves is the most commonly used method of improving usability, especially in Internet applications, where reading is much greater than writing, so increasing the usability of reading is one of the first, master-slaves is to let the writing operation focus on a database Master, The master then copies the updated operation to the other database slaves, and the read operation occurs on the slaves, and the frame composition is as follows:
If the Slavec is not available, read and write will not be interrupted, such as Slavec after the recovery will automatically synchronize the lost data, but also can be re-put into operation, maintainability is very good. But if Master has a problem, it is troublesome, so it only solves the high availability of reads, but does not guarantee high availability of writes. The actual combat of master-slaves can refer to a previous blog post to build a high-performance web------MySQL read and write separate combat
2) Master-master
To address the high availability of the above-mentioned writes, MySQL provides the Master-master replication architecture, as follows:
Generally write to Mastera, Mastera sync data to Masterb, when Mastera have a problem, will automatically switch to Masterb, Mastera restore, Masterb sync data to Mastera
3) master-master-salves
Master-master-salves is a combination of the above two scenarios, which provides both read and write high-availability replication architectures, as shown in:
MySQL Cluster
MySQL cluster consists mainly of three parts:
- SQL Server node
- NDB Data Storage Node
- Monitoring and Managing nodes
The composition of the three divisions is as follows:
Such hierarchies are also related to the architecture of MySQL itself that separates SQL processing and storage, and the architecture of MySQL shows the previous blog design and development application Server (i)------common patterns
This allows MySQL cluster to make a highly available replication strategy at two levels of SQL processing and storage, respectively. At the level of SQL processing, it is easier to do clusters because these SQL processing is stateless and can be enhanced by increasing the availability of machines. At the storage level, the availability of storage is increased by backing up each node, similar to MySQL Replication, as shown in the following diagram:
Oracle RAC
Oracle RAC and MySQL cluster are somewhat similar, but are mainly focused on the high availability of the SQL processing layer, but not much on storage, as shown in the structure diagram:
Its main advantage is that it is transparent to the application, and the availability is very high through heartbeat detection, the main disadvantage is that the storage is shared and the storage is not scalable enough.
IBM HACMP
IBM hacmp is similar to Oracle RAC and is primarily used for dual-machine interoperability, as shown in the following operating procedures:
1) Two servers as dual system (host A and B) run simultaneously in the HACMP environment;
2) Server In addition to the normal operation of the application, but also as the other side of the backup host;
3) Two host systems (A and B) monitor each other's operation (including the system's hardware and software operation, network communication and application operation) through "Heartbeat line" during the whole operation process.
4) Once the other host's operation is found to be abnormal (failure), the application on the fault machine will immediately stop running, the machine (the backup machine of the fault machine) will immediately start the application on the fault machine on its own machine, the application of the fault machine and its resources (including the use of IP address and disk space, etc.) to take over, Make the application on the fault machine continue to operate on the machine;
5) Application and resource takeover process is done automatically by HA software without manual intervention;
6) When the two hosts are working properly, you can also switch the application on one of the machines to another machine (backup machine) as needed.
Oracle ASM
Oracle ASM provides storage scalability with high availability through automated storage management plus back-end scalability for storage arrays, as shown in the following diagram:
As a result, you can try to combine Oracle RAC and ASM, while providing high availability of SQL processing and storage, which is what MySQL cluster wants to achieve
Database Highly Available Architecture reprint