Distributed MySQL Databases use a single master with multiple slave architectures. Through the replication of master and slave, the application server can query slave through the Load balancer. In this way, the query can be distributed across multiple servers.
In this case, the application should send only the query of read classes such as select to the Server Load balancer, and the update query should be sent directly to the master. If an update query is executed on the slave, the content of the slave and Master cannot be synchronized. MySQL detects the content difference between the master and slave and stops replication. This will cause system faults. Therefore, the update must be sent to the master.
In addition, there is still a way to use a Load balancer (such as LVS) before slave. For example, you can control query allocation in an application or use a MySQL proxy class.
Therefore, the distributed architecture of MySQL has only one master, which is not suitable for updating too many queries. Generally, web applications read queries much more than update queries, so the query conditions can be met. However, there are also many update queries, such as the function of recording the number of video playback times, which must be updated every time a video is played. In this case, we still need to split the table to reduce the table size. Split to distribute write operations. If table files can be split, they can be distributed to multiple hard disks on the same machine, or to multiple servers. Then, we can consider not applying RDBMS, instead using key-value for storage.
In addition, database segmentation also has its own advantages and disadvantages:
Advantages
Disadvantages
O & M becomes complex and failure rate increases
After O & M becomes complex, the economic cost will also rise.
The current Memory price is also low