MySQL Add from library method

Source: Internet
Author: User

#现有环境是一主一从, you need to add another one from the library, as follows:

Synchronizing the test database

Master: 192.168.3.203
From 1:192.168.3.210
From 2:192.168.3.211
1. Set up accounts for 210 and 211 on primary server 203.
Mysql-uroot-p123
Grant Replication Slave on * * to ' backup ' @ ' 192.168.3.210 ' identified by ' backup ';
Grant Replication Slave on * * to ' backup ' @ ' 192.168.3.211 ' identified by ' backup ';
Flush privileges;
2. Copy the data file from 1 to the top of the 2
Mysql-u root-p123-s/usr/local/mysql_p/mysql.sock
Stop slave;
Mysqldump-u root-p123-s/usr/local/mysql_p/mysql.sock Test >test.sql
SCP Test.sql [Email protected]:/root/
Record the main read_master_log_pos file location
Show Slave Status\g
1. Row ***************************
Slave_io_state:
master_host:192.168.3.203
Master_user:backup
master_port:3306
Connect_retry:60
master_log_file:mysql-bin.000021
read_master_log_pos:56669406
3. Recovering from a 1 backup from 2
Mysql-u root-p123-s/usr/local/mysql_p/mysql.sock
Create DATABASE test;
Use test
Source/root/test.sql
Stop slave;
Change Master to
Master_host= ' 192.168.3.203 ', master_user= ' backup ', master_password= ' backup ', master_port=3306,master_log_file= ' mysql-bin.000021 ', master_log_pos=56669406;
Start slave;
4. Operate from 1 server 210
Mysql-u root-p123-s/usr/local/mysql_p/mysql.sock
Start slave;

This article is from the "Chengdu @ Ah-like" blog, please be sure to keep this source http://azhuang.blog.51cto.com/9176790/1440202

MySQL Add from library method

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.