Home >Backend Development >PHP Tutorial >Optimizing Availability with MySQL Built-in Replication (4)_PHP Tutorial

Optimizing Availability with MySQL Built-in Replication (4)_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 17:22:05860browse

Step 3: Create a mutual master-slave relationship
First, in the my.cnf file on machine B, add "log-bin" to the [mysqld] section, then restart mysqld, and then create a command that can be executed on it For the user account of the replication function, use:
GRANT FILE ON *.* TO replicate@10.1.1.1 IDENTIFIED BY "password";
Run the "FLUSH PRIVILEGES" command on machine B to load it after adding the replication user Create a new authorization table, then go back to machine A and add the following lines to its "my.cnf":
master-host=10.1.1.2
master-user=replicate
master-password =password
After restarting the service program of machine A, now we have a mutual master-slave relationship between machine A and machine B. No matter which server a record is updated or a record is inserted, it will be copied to the other server. Note: I'm not sure how quickly a standby machine can merge binary log changes, so using this method to load balance insert or update statements may not be a good idea.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532382.htmlTechArticleStep 3: Create a mutual master-slave relationship. First, in the my.cnf file on machine B, in [mysqld ] section, then restart mysqld, and then create a copy on it...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn