ECS under the two MySQL master from the settings

Source: Internet
Author: User

First, Master repository configuration Master

1. The user root account enters MySQL

Mysql-uroot-p

2. Create an account for master-slave synchronization, and give permissions, because this account is only used as synchronization data, so the allocation of permissions not too large, I have only given three permissions:

GRANT REPLICATION SLAVE on * * to ' repl ' @ '% ' identified by ' password ';(here the% can be converted directly from the library's IP)

Grant REPLICATION CLIENT on *. * to REPL;

Grant SUPER on * * to REPL;

Flush privileges;

3. Open MY.CNF

Vim/etc/my.cnf

Find Server-id

Modify the following:

Server-id = 28 (the number here is best changed to the last three bits of the master's IP)
Log-bin = Mysql-bin (This one if not added)

4. View the status of the main library:

SHOW MASTER STATUS;

Note: Both the file and position values. The configuration is used when it is from the library.

Master Even if the configuration is complete.

Second, from the library section Slave

1. Open MY.CNF

Vim/etc/my.cnf

Find Server-id

Modify the following:

Server-id = 111 (the number here is best changed to the last three bits of the master's IP)
Log-bin = Mysql-bin (This one if not added)

2. Execute the important statement:

Change Master to master_host= ' main Library IP ', master_user= ' the user name created by the main library just now ', master_password= ' the password corresponding to the user name established by the main library ', master_log_file= ' Mysql-bin.000010 ', master_log_pos=659;

Note: The Master_log_file and Master_log_pos here are the last steps to configure the main library to display the file and position

3. Perform the synchronization:

Start slave;

4. View Status:

show slave status\g;

The main thing is that these two yes, must be all yes, otherwise it is unsuccessful. If not successful, please continue to look down:

Three, there are two cases of unsuccessful:

1. View the firewall for the main library:

There are two types of solutions for firewalls:

A. Turn off the firewall:/etc/init.d/iptables stop

B. Open the firewall and add a permission to access:

Vi/etc/sysconfig/iptables

If the account set up on master is not%, but specifies the IP from the library, join:-a input-s 124.239.176.60-p tcp-m tcp--dport 3306-j ACCEPT

If it is%, join:-a input-s%-P tcp-m TCP--dport 3306-j ACCEPT

Save, exit, restart Firewall

/etc/init.d/iptables restart

2. Check if there is file on MASTER, if no re-execution: Show Master STATUS;

And then do it again:

Change Master to master_host= ' main Library IP ', master_user= ' the user name created by the main library just now ', master_password= ' the password corresponding to the user name established by the main library ', master_log_file= ' Mysql-bin.000010 ', master_log_pos=659;

Of course, the Master_log_file and Master_log_pos here are the last steps to configure the main library to display the file and position

ECS under the two MySQL master from the settings

Related Article

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.