Recently to the new on-line project to build a master-slave structure, so organize some useful things out, for record:
One. MySQL's master-slave replication scenario:
MySQL master-slave replication facilitates the robustness of database structures, improves access speed and facilitates maintenance management.
1). master-slave servers are backed up by each other
The design of the master-slave server architecture can greatly enhance the robustness of the database architecture. For example, when there is a problem with the primary server, we can manually or automatically switch to continue to service from the server.
This is similar to NFS, where NFS storage data is synchronized to the backup via Inotify+rsync, except that the MySQL synchronization scheme is its own tool.
2). master-Slave server read and write separate share site pressure:
The architecture of the master-slave server can be read/write separated from the user's request through the program (Php,java) or proxy software (Mysql-proxy,amoeba), that is, by simply processing the Select check on the slave server
queries, reducing the user's query time and the pressure on the primary server for both read and write, and for the updated data (update insert Delete) is still given to the primary server to ensure that the primary server
And from the server to maintain real-time synchronization, if the site is a non-update-based business, such as Blog,www's home display and other services, query more requests, which is from the server read and write separation load balancing policy
is very effective, this is the read-write separation data structure.
Medium and large companies: through the program (Php,java)
Test environment: Agent Software (Mysql-proxpy,amoeba)
Portal: Distributed Dbproxy (read/write separation, hash load balancing, health check).
The following is a common MySQL architecture:
MySQL master-slave copy some of the things sorted