使用xbstream 備份到遠程服務器
##xbstream 備份到遠程服務器 innobackupex \ --defaults-file="/export/servers/mysql/etc/my.cnf" \ --host="localhost" \ --port=3358 \ --user="backuper" \ --password="backup@123" \ --stream=xbstream "/export/mysql_backup/" \ | ssh root@10.0.0.2 \ "gzip ->/export/mysql_backup/mysql_backup.gz" ## 由於備份文件使用xbstream和gzip進行兩次壓縮,因此需要進行兩次解壓 ## 第一次使用gzip解壓備份 gzip -d mysql_backup.gz ##第二次使用xbstream解壓gzip xbstream -x < mysql_backup
使用tar備份到遠程服務器
##tar備份到遠程服務器 innobackupex \ --defaults-file="/export/servers/mysql/etc/my.cnf" \ --host="localhost" \ --port=3358 \ --user="backuper" \ --password="backup@123" \ --stream=tar "/export/mysql_backup/" \ | ssh root@10.0.0.2 \ "gzip ->/export/mysql_backup/mysql_backup.tar.gz" ##使用tar解壓 tar -ixzvf mysql_backup.tar.gz
本地限速備份(使用PV限速)
## 備份到/export/mysql_backup/full ## 使用tar進行流備份,限速后再使用tar -x 解壓 cd /export/mysql_backup/full innobackupex \ --defaults-file="/export/servers/mysql/etc/my.cnf" \ --host="localhost" \ --port=3358 \ --user="backuper" \ --password="backup@123" \ --stream=tar \ "/export/mysql_backup/tmp/" |pv -q -L50m | tar -x