MySQL 5.7.10 under Mutual primary configuration

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.