STEP 1: Take a backup from any server on the replication environment, master or slave

在任意节点全备:

1
2
innobackupex /data/backups/  

1
2
3
$ cat xtrabackup_binlog_info
mysql-bin.000002 1232 c777888a-b6df-11e2-a604-080027635ef5:1-4

STEP 2: Prepare the backup

1
2
TheMaster$ innobackupex --apply-log /data/backups/$TIMESTAMP/  

STEP 3: Move the backup to the destination server

1
2
TheMaster$ rsync -avprP -e ssh /path/to/backupdir/$TIMESTAMP NewSlave:/path/to/mysql/  

1
2
NewSlave$ chown mysql:mysql /path/to/mysql/datadir  

STEP 4: Configure and start replication

1
2
3
4
5
6
7
NewSlave > SET GLOBAL gtid_purged="c777888a-b6df-11e2-a604-080027635ef5:1-4";
NewSlave > CHANGE MASTER TO
MASTER_HOST="$masterip",
MASTER_USER="repl",
MASTER_PASSWORD="$slavepass",
MASTER_AUTO_POSITION = 1;

注:
innobackupex was previously deprecated and has been removed from Percona XtraBackup 8.0-3-rc1 .