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 

 

posted @ 2019-06-05 17:03  TeyGao  阅读(4509)  评论(0编辑  收藏  举报