MySQL Enterprise Common Cluster Architecture

Reprinted from https://blog.csdn.net/kingice1014/article/details/76020061

1. MySQL enterprise common cluster architecture

 

in small and medium-sized Internet enterprises. The mysql cluster is generally the architecture shown above. When the WEB node reads the database, it reads the dbproxy server. The dbproxy server separates the read and write of the database by judging the SQL statement. The read request is loaded to the slave library (the master library can also be added), and the write request is written to the master library.

The dbproxy here is the only outlet of the database cluster, so it also needs to be highly available.

drproxy is a common software for database read and write separation, and amoeba, mycat, and cobar are also commonly used. This kind of software not only has the function of read-write separation, but also can realize load balancing and health check of back-end nodes.

In addition to implementing such database middleware software, the read-write separation of the database can also be written in the program.

Usually, our main library should be dual-master high availability, so that the main library can take over immediately when the other main library hangs up. If you do not do dual masters, you need to do state migration when the slave library takes over the master library, and there will be a delay.

The high availability of the main database database needs to consider data synchronization. The more commonly used high-availability solutions are:

1. Keepalived+mysql replication. VIP is elegant through keepalived, and data synchronization is realized through replication, the synchronization scheme that comes with mysql.

2. hearbeat+drbd. The synchronization of dual-master data is achieved through drbd, which is based on block devices. Much faster than normal synchronization schemes. Implement VIP drift and switch management of drbd resources through heartbeat.

3、keepalived+mha。

For slave libraries, it is best not to exceed 5. We can use three of them as nodes accessed by users and the other as a query node for internal personnel. Because the internal staff usually query the nodes according to the time period, without indexing, and occupy a lot of resources, so this node should be dedicated to avoid affecting customer access. Finally, we should leave a data backup from the database for the database.

The data consistency of the slave library can be maintained by master-slave assistance directly from the master library, or master-slave replication from other slave libraries (the advantage is that the pressure on the master library is reduced, and the disadvantage is that the delay is slightly larger).

 

2. MYSQL data schema

Database server=="Database (multiple instances)=="Multiple libraries=="Multiple tables=="Multiple field rows and columns (data)

A database server can run multiple instances, one instance has multiple libraries, one library has multiple tables, and one table has multiple rows and columns.

 
 
QQ picture 20160620100754.png

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324974626&siteId=291194637