Mysql database in a multi-server clusters of how to ensure data synchronization?

Unsynchronized data anomalies usually occurs at the same time there are multiple data write operation takes place. Therefore, to avoid the data in the database is not synchronized with the problem, we should avoid the simultaneous operation of multiple write data, while only a write operation.

This is when a server running seems to be no problem, but if more than one web server, then it is a problem.

?

A good way is, you can read and write separation, all read operations can be read directly from the database among servers. But the write operation, the general web server does not have the authority, if the need to write it would need to set a proxy server database dedicated to write, so write all through the web server has write permissions to the database of proxy servers, so do not write there is a parallel, but serial, but only for a data write operation.

Mysql default engine before executing the query (SELECT), it will automatically give all the tables plus a read lock involved, before performing the update operation (UPDATE, DELETE, INSERT, etc.) automatically to the table write-lock involved in this process and It does not require user intervention, so that users generally do not need to directly command lOCK tABLE MyISAM table explicit lock.

?

For more bloggers is yet still theoretical, not practical experimented.

Guess you like

Origin www.cnblogs.com/shujutongbugongju/p/11019863.html