This 17 key issues in MySQL, we must find out!

Mysql is very common, related topics are also very much with mysql, such as performance optimization, high availability, strong consistency, security, backup, clustering, scale, scale up, load balancing, read and write separation .

To grasp the essence of them, you may have to spend a lot of skill, though popular alternative to mysql there are many, but the most likely to maintain the minimum cost point of view, mysql or preferred. From the perspective of the following scenarios cut, the technical point of mysql organize, write a knowledge maps to facilitate more in-depth study and summary.

Finishing the figure below, I tried to Mysql into six kinds of scenarios, the key issues to be considered in each scenario is different, which leads to knowledge needs filled at different problems, continue to follow these knowledge-based learning and finishing. (I look forward to comments and provide learning materials, thank you!)

java8-1575811998.jpguploading.4e448015.gifDump failed to re-upload canceledThis 17 key issues in MySQL, we must find out!

A single Master

java3-1575811998.jpguploading.4e448015.gifDump failed to re-upload canceledThis 17 key issues in MySQL, we must find out!

 

Case of a single Master is widespread, for many personal sites, startups, small internal systems, taking into account the cost, frequency of updates, and other issues of systemic importance, the system depends only on a single case database service, basically meet the demand. Under this scenario, I think the topic should be the focus of attention has shown above four points.

The most important aspect is data backup, if the trading volume is very low, and has a very definite period of service characteristics, then a simple mysqldump is competent. But it is flawed, doomed to data from the backup point between restore points will be lost after the data reduction. However, in the most extreme cases, the backup job is not sloppy, a few small details listed below, then will share more operational articles.

1) Cold Standby:

Stop, direct physical copy files, InnoDB engine (frm file, file sharing table space, a separate table space for files, redo log file, my.cnf).

Recovery: to copy the file to a directory.

2) Tracking:

Alternatively Ibbackup XtraBackup tool redo log file records the LSN checkpoints, copy files, and shared table space tablespace files independent (without any obstruction), the redo log file recorded copy of the LSN checkpoint, the backup copy is re-generated do log.

Recovery: restore table space files, applications, redo log files.

3) Preparation Temperature:

mysqldump, - single-transaction parameter transaction management to ensure data consistency. DDL statements can not be used when backing up. Recovery: direct executable file, mysql -uroot -p <filename .sql>

Binary semi-synchronous replication, the master copy from the server increments

Recovery: mysqlbinlog

Second, a master-slave

java6-1575811998.jpeguploading.4e448015.gifDump failed to re-upload canceledThis 17 key issues in MySQL, we must find out!

Consider one Lord, one from the original intention of the majority of high-performance, and system availability issues, in addition to backup a single Master scene need to do, as well as performance optimization, separate read and write, load balancing three key tasks need to be considered.

Which are more performance-optimized content, is also a big theme of service indicators from the system as a basis for taking appropriate action, most systems are required to fulfill the request within three seconds, the overall down conversion, the database can probably have a total of 1.5 seconds to perform time to meet the performance requirement is reasonable optimization.

After such a priority to organize content are: Index Tuning -> Table Design Optimization -> Database Configuration Optimization -> hardware optimization.

Separate read and write and load balancing are relatively simple to achieve, maintain my current system is relatively backward, do not read and write separation, because the function is set to report class-based system, and load balancing is dependent on php code to do, from the actual operation and maintenance point of view, it is not good enough, and the code embedded in the load balancing over the business logic code, code maintenance to bring some noise. After plans for a variety of middleware practice and performance testing, the time to share some of the test data out.

Third, from a master n

java0-1575811998.jpguploading.4e448015.gifDump failed to re-upload canceledThis 17 key issues in MySQL, we must find out!

 

Once you start considering multi-server architecture from a master, then prove your system availability, consistency, performance in one or more of the requirements are relatively high. The system began to build in a lot of time will go in this direction in line, after all, "looks" a lot will be robust.

But in fact, we can not rely solely on the configuration and mysql mysql own middleware to solve the availability problem of consistency.

Fourth, lateral clusters

This 17 key issues in MySQL, we must find out!

 

The system needs to huge sub-library sub-table, in fact, is a gratifying thing, but remember that after the aforementioned performance optimization work to achieve the ultimate go considering the complexity of these systems increases the solution. Lateral clusters mainly the system from the perspective of business segmentation features, the most thorough is segmented into various subsystems to put some of the core data sharing between subsystems through some data synchronization programs, in order to avoid cross-cross-database library calls join.

Then the various system interface calls, the big split the transaction into small transactions, good isolation and synchronization between transactions. Three issues in the figure above the lateral cluster architecture system should belong to a very unique problem, in fact, the actual project is to try to avoid the presence of these needs, but if you really need, and there must be a solution. After finishing will also address these issues one by one, and test some of the so-called middleware that support these features.

Five vertical clusters

java3-1575811998.jpeguploading.4e448015.gifDump failed to re-upload canceledThis 17 key issues in MySQL, we must find out!

Segmentation lateral thinking is ultimately cut molecular cluster system, and the most difficult problems encountered in the last vertical cluster is scalable capacity, operation and maintenance of a system I was ahead of the data made 256 slices, 256 slices 0 to 127 sections 128 to 255 and there are two sections, respectively from a master database cluster two, operation and maintenance of the system more than three years, there is no expansion requirements. Should be designed to give consideration, assume the day data is very large, can be divided into 4 large sections 256, are stored in the two four from a cluster master, in order to achieve expansion.

This idea is indeed desirable, but our sub-library is the logic of the current php code to achieve, but also affect the business logic code to a certain extent, operation and maintenance a bit frightened, or keep business code refreshing better.

After the next will introduce some implementations the use of middleware libraries routing function, but also according to the actual situation to think of some of the expanding volume reduction program practice again, please look forward to sharing the practical operation of the effect.

Sixth, mixed mode

Not so much this part of the discussion above five kinds of mixed scene, as it is doing this part are summarized. The above five kinds of scenes, listed a total of 17 problems, 17 problems which are basically superposition, the more in-depth framework to do more together to consider this question 17 points. 17 to consider the whole problem, the problem of mixed mode is not a problem. High-quality video programming shangyepingtai.xin

Published 122 original articles · won praise 47 · views 30000 +

Guess you like

Origin blog.csdn.net/fengzongfu/article/details/105267956