mysql-5.7.16-linux-glibc2.5-x86_64 streamlined master-slave configuration

Source: Internet
Author: User

1. Create a copy account and grant replication permissions
CREATE USER ' Fansik ' @ ' 10.% ' identified by ' Fansik ';
GRANT REPLICATION SLAVE On * * to [email protected] ' 10.% ';

2. Get the binary name and coordinates of the synchronization
Login database (Root):
Set Read lock
FLUSH TABLES with READ LOCK;
View Log coordinates
SHOW MASTER STATUS;
FILE is the following master_log_file
Position is the following Master_log_pos

3. Export Master All data
Mysqldump--all-databases--master-data-uroot-p > Fansik.db

4. Log in to the database (root) and unlock
UNLOCK TABLES;

5,/etc/my.cnf from the library must have at least the following configuration, Server-id cannot be the same as Master Oh
Span style= "font-family: imitation; Font-size:18px ">[mysqld]
server-id = 811
Span style= "font-family: imitation; font-size:18px ">skip-slave-start=true
read_only=on
relay-log=relay-bin
relay-log-index=relay-bin.index
Remember to restart the library

After modifying the configuration file

6, log in from the database, make the master database information
Mysql> Change MASTER to
Master_host= ' 10.2.4.1 ',
Master_user= ' Fansik ',
Master_password= ' Fansik ',
Master_log_file= ' mysql-bin.000006 ',
master_log_pos=154;

7. Import the information exported from the main library into the database
Mysql-uroot-p < Fansik.db

8, log in from the database, start synchronization
Start slave;

9. Check if the replication status is normal
Slave_io_running:yes
Slave_sql_running:yes
If all is yes the configuration is successful

mysql-5.7.16-linux-glibc2.5-x86_64 streamlined master-slave 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.