Replication completes the configuration of m-s (master-slave), replicationm-s

Source: Internet
Author: User

Replication completes the configuration of m-s (master-slave), replicationm-s


Replication completes m-s Configuration in a few steps
1. grant permissions on the master
Grant replication slave on *. * on 'sync' @ 'slaveip' identied by 'Password ';
Flush privileges;


2. master Configuration
[Mysqld]
Log-bin
Binlog-format = row -- provides performance
Sync-binlog = 1 -- officially recommended
Server-id = 1


3. Make a full backup of the master.
Innobackupex -- user = dba -- password = beifen/var/lib/backup/
Innobackupex -- use-memory = 500 m -- apply-log/var/lib/backup/2015-06-13_10-38-21/


4. Copy full backup to slave and restore the backup
Scp/var/lib/backup/2015-06-13_10-38-21/slaveip:/var/lib/backup/
Cd/var/lib/backup/2015-06-13_10-38-21/
Service mysql stop
Mv */var/lib/mysql
Chown-R mysql. mysql/var/lib/mysql


5. slave Configuration
[Mysqld]
Server-id = 2


6. View and record the position id in the binary log
Cd/var/lib/mysql
Cat xtrabackup_binlog_info


7. Configure slave replication
In slave
Change master
Master_host = 'master _ ip ',
Master_user = 'dba ',
Master_password = 'beifen ',
Master_log_file = 'host2-bin.000000 ',
Master_log_pos = 120;


8. Start replication and check the results
In slave
Start slave
Show slave status \ G;

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.