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;