MySQL Backup--Xtrabackup远程备份和限速备份


使用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 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM