MySQL installation method is not introduced here, there are many tutorials on the internet
Environment Introduction:
A host: win2008_x64+mysql5.7.10 64-bit, ip192.168.7.180
B Host: win2008_x64+mysql5.7.10 64-bit, ip192.168.7.181
1, first configure the My.ini file, both hosts need to be configured (usually under the MySQL installation directory)
A host: My.ini,[mysqld] node, add the following information
log-bin=mysql-bin server-id=181
B Host: My.ini,[mysqld] node, add the following information
log-bin=mysql-bin server-id=
Add a MySQL service that requires two hosts to be re-configured after the above configuration.
2. Create Replication users
Execute the following command on host a:
' Repl ' @'192.168.7.181'12345678 '
Execute the following command on Host B:
' Repl ' @'192.168.7.180'12345678 '
3. Check the MySQL bin log location of the two hosts
First lock the table in MySQL for two hosts
FLUSH TABLES with READ LOCK;
FLUSH TABLES with READ LOCK; Represents the lock table and disables all operations. Prevents the bin log position from changing.
View a host bin log location
SHOW MASTER STATUS;
A host result
View the bin log location of Host B
SHOW MASTER STATUS;
B Host Results
Record a host result, and B host result
And then unlock the MySQL table for both hosts.
Unlock Tables;
4. Start setting Slave Replication
A host executes the following command:
' 192.168.7.181 ' ' Repl ' '12345678'mysql-bin.000001 ' = 467; START SLAVE;
Host B executes the following command:
' 192.168.7.180 ' ' Repl ' '12345678'mysql-bin.000001 ' = 315; START SLAVE;
5. Check whether the two hosts are set successfully
Show Slave Status;
If both hosts slave_io_running and slave_sql_running are yes, the settings are successful. Database operation is possible.
MySQL 5.7.10 under Mutual primary configuration