Now to do the MySQL database master and slave configuration, there are several ways, do not know which kind of better:
1 through PHP code to achieve, if it is selest to go from the database (read), or go to the main database (write)
2 Handling via Nginx
3 through MySQL's own configuration to achieve
Do not know which extensibility and maintainability is a little better
Reply content:
Now to do the MySQL database master and slave configuration, there are several ways, do not know which kind of better:
1 through PHP code to achieve, if it is selest to go from the database (read), or go to the main database (write)
2 Handling via Nginx
3 through MySQL's own configuration to achieve
Do not know which extensibility and maintainability is a little better
MySQL configuration is better, because Master and slave is not only to improve the efficiency of read operations, but also to consider the master-slave replication and backup situation
MySQL has configured a master-slave backup to build an Atlas machine, and then rely on the atlas for read and write separation, configured to automatically write to master, for high-real-time data can also be forced to specify the read operation of the Master
Read-write separation, and then use Cobar or TDDL, according to a certain routing rules, the data to be written to the database sub-table operation. At the same time, the scheduled task, real-time data to write the database synchronization to read the database.