Practical process
Source database server (192.168.1.101) | Backup server (192.168.1.102) | |
surroundings | centos 7.4 mysql5.7 | centos 7.4 |
Database instance | 3306 | / |
Install backup tools | Xtrabackup | / |
Install network speed limit tool | yum install pv #If you don't do network speed limit, you don't need to install |
/ |
SSH password-free login | ssh-keygen #Enter all ssh-copy-id -i /root/.ssh/id_rsa '-p 22 192.168.1.102' |
|
Create a backup directory | mkdir -p /data/backup | mkdir -p /data/backup |
Backup and speed limit | innobackupex --user=root --password=123456 -S /tmp/mysql.sock --defaults=/etc/my.cnf --slave-info --stream=tar /data/backup | pv -q -L10m | ssh -p 22 [email protected] cat " >" /data/backup/all_test.tar
# Description: pv -q -L10m: speed limit 10MB/S |
|
Backup complete | - | - |
View backup files | ls /data/backup #No file | ls /data/backup |
Unzip the backup file | tar -xf /data/backup/all_test.tar | |
Apply binlog (restore) | innobackupex --apply-log /data/backup #If you don’t restore, you can skip this step #Need to install Xtrabackup tool |
Special note : If the backup file is used as a slave library, please ensure that the master library has been configured as follows before backing up, otherwise the master-slave cannot be created:
log-bin = binlog
binlog_format = row
server_id = 191
gtid_mode = on (If you don’t turn it on, you can only synchronize location points, not GTID)
enforce_gtid_consiste = on (If you don’t open it, you can only synchronize the location, not GTID)