In the MARIADB environment introduced yesterday,
Turn on MySQL in the two host m1,m2, respectively,
First Enter VI/ETC/MY.CNF/
To see what's in "mysqld":
The server_id in the configuration file is to be modified, corresponding to the serial number of the host.
After starting MySQL, enter show master status;
Log file name and location values are recorded and viewed separately on m1,m2.
On M1, grant the permissions from M2 on the M2, and also grant the permissions from the M1 on the:
There are two parts to be aware of:
1. The network segment address of the host. (My m1 and M2 are the 192.168.100 network segment)
2. Password. (Easy memory Selection 123456)
Grant replication Slave on
.To ' replication ' @ ' 192.168.100.% ' identified by ' 123456 ';
After that, the IP address and log file name, location values are declared to each other:
####################################################################################
Change Master to (due to space limitations, this line and downlink is actually a command, note there are spaces) master_host= ' 192.168.100.102 ', master_user= ' replication ', Master_ Password= ' 123456 ', master_log_file= ' mysql_bin.000007 ', master_log_pos=245;
########### #注意, on M1 to specify the log file name on the M2, and the positional parameters-----on the M2 to reverse. ############
Start from the service and enter show slave status; (If garbled, you can add \g at the end of the sentence to parse)
If both of these conditions are "yes," the M1 and M2 have been successfully synchronized.
(if not, then the previous mutual authorization has an error, need to re-authorize, re-authorization need to first switch off from the service, enter the stop slave;)
()
Then randomly create or delete a database on one of the hosts, and you will notice that another host is also changing.
Synchronizing MySQL in Linux