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

WBOY
Release: 2016-07-13 17:22:05
Original
804 people have browsed it

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...
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!