What is the difference between Mysql master-slave replication and clustering? What are the applicable scenarios?

redis master-slave replication is obviously different from clustering. The former is to provide redundancy and high availability, while the latter is to store data separately. Different redis nodes have different data.

but mysql master / slave and cluster seem to have the same data, which is completely different from the difference between redis master / slave / cluster. What scenarios are mysql master / slave and cluster suitable for respectively?

Mar.23,2021

the role of mysql master and slave:
1. Data hot backup: as a backup database, after the failure of the master database server, you can switch to the slave database to continue to work to avoid data loss.
2, extension of the architecture: the business volume is getting larger and larger, and the access frequency of Icano is too high to be satisfied by a single machine. At this time, do multi-database storage to reduce the access frequency of disk Icano, and improve the performance of a single machine.
3. Read-write separation enables the database to support greater concurrency. It is especially important in the report. As part of the report sql statement is very slow, resulting in table lock, affecting the front desk service. If the foreground uses master, reports using slave, then the report sql will not cause the foreground lock, ensuring the speed of the foreground.
or if the number of visits and concurrency of the site is too large, a small number of database servers can not handle it, resulting in slow access to the site. Data writing will cause the data table or record to be locked, which means that other access threads cannot read and write until the write is completed, which will affect the reading speed of other users. Master-slave replication allows some servers to read exclusively, while others to write specifically to solve this problem.

while the cluster is a way to directly increase the amount of reading and writing that can be carried, and the effect is better than that of the master and follower.


Master-slave read-write separation
cluster cluster multi-node read and write at the same time
Master-slave write pressure expansion is multiple sets of master-slave, which is relatively troublesome, but the architecture is flexible and the performance
Multi-point read and write cluster mode can not avoid a write performance problem. Writing a node requires Synchronize to all nodes to count as the end of a transaction. The advantage is that the hanging of any node does not affect the use of the cluster


is not easy to say (not very familiar with). Give me an example! If a website has a large number of visitors, then the pressure of reading and writing may be great. In order to improve performance, user experience, etc., master-slave is used, master data is not understood, and slave redis is used to read and write quickly to meet user needs. On the other hand, clusters can be used for different regions and different clusters. For example, one branch is from Guangdong and the other is from Fujian.

Menu