Xtrabackup遠端備份

2022-10-11 07:27:14 字數 611 閱讀 5697

生產環境中常常將資料庫備份至遠端伺服器,本次測試中,資料庫伺服器:192.168.8.50,遠端備份中心:192.168.8.63

1、配置ssh秘鑰認證

ssh-keygen -t rsa

ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]

2、使用tar進行備份並以時間對備份進行命名

/usr/local/xtrabackup/bin/innobackupex --defaults-file=/etc/my.cnf --user=root --password=mysql --port 3306 --socket=/tmp/mysqld.sock --stream=tar ./ | ssh [email protected] \ "cat - > /backup_center/$(date +%y-%m-%d_%h:%m:%s).tar"

3、登入備份伺服器檢視備份檔案

[root@oneproxy backup_center]# ll

total 3683656

-rw-rw-r-- 1 mysql mysql 3772058112 aug 9 16:24 2018-08-09_16:08:13.tar

Xtrabackup遠端備份 限速

遠端備份乙個好處是,不占用本地磁碟空間,可以直接備份到遠端主機指定的目錄。但在資料量很大的情況下要防止網路中斷導致的遠端備份失敗。方法1 ssh 密碼的方式 innobackupex host 192.168.30.11 user root password 1234 port 3306 strea...

XtraBackup的流式備份和遠端備份

xtrabackup支援流式備份,將備份以指定的tar或xbstream格式傳送到stdout,而不是直接將檔案複製到備份目錄。xtrabackup不壓縮備份案例,命令如下 xtrabackup壓縮備份案例,命令如下 xtrabackup遠端備份案例,命令如下 innobackupex defaul...

xtrabackup備份說明

通過最簡單的備份事例,說明備份所包含的內容等資訊 xtrabackup backup target dir tmp backup指定用於備份,預設全備 target dir指定備份檔案目錄 生成備份目錄xtrabackup backupfiles cd xtrabackup backupfiles ...