Step Two: Configure the standby machine
Let's move on. Stop the MySQL service program on the standby and move the database directory copied from the host to the data directory on the standby machine. Please make sure to change the owner and group of the directory to the corresponding value of the MySQL user, and modify the file mode to 660 (only the owner and the group is readable, writable), the directory itself is 770 (only for the owner and the group is readable, writable and executable).
Go on. Start the MySQL service on the standby and verify that MySQL is working properly. Run several select queries (do not update or insert queries) to see if the data snapshot you obtained in the first step was successful. Next, turn off the MySQL service program after the test is successful.
Configure the host to be accessed on the standby to receive host changes. So you need to edit the "my.cnf" file on the machine and add the following lines in the [mysqld] section:
master-host=10.1.1.1
Master-user=replicate
Master-password=password
After starting the standby service program, the standby service program will look at the host specified in the "my.cnf" file to see if there are any changes and merge these changes into its own database. The standby maintains the host's update record, which is received from the host's "Master.info" file. The state of the standby thread can be seen through the SQL command "SHOW slave-status". Handling binary logs on standby causes an exit of the standby thread and generates a message in the *.err log file if an error occurs. The error can then be corrected, and the standby thread can then be restarted using the SQL statement "SLAVE start". The thread will continue processing from where the host binary log processing is interrupted.
At this point, the data changes that occurred on the host should have been copied to the standby, to test it, you can insert or update a record on the host, and select this record on the standby machine.
Now we have this master-slave relationship from A to B, so that when a machine is possible, it allows us to redirect all queries to the B machine, but when the a machine recovers, we have no way to restore the changes to the a machine. To solve this problem, we create a master-slave relationship from Machine B to machine A.
http://www.bkjia.com/PHPjc/532381.html www.bkjia.com true http://www.bkjia.com/PHPjc/532381.html techarticle Step Two: Configure the standby machine let's continue. Stop the MySQL service program on the standby and move the database directory copied from the host to the data directory on the standby machine. Please confirm that the directory is ...