1. 程式人生 > >mysql .xb 資料庫備份恢復

mysql .xb 資料庫備份恢復

mysql .xb資料庫備份恢復
https://cloud.tencent.com/document/product/236/33362

備份檔案先經過 qpress 壓縮,後經過 xbstream 打包

1, 安裝 xbstream
yum install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm
yum install percona-xtrabackup-24

報錯:
https://blog.csdn.net/xinjing2015/article/details/88178789

The GPG keys listed for the "Percona-Release YUM repository - x86_64" repository are already installed but they are not correct for this package.
Check that the correct key URLs are configured for this repository.


 Failing package is: Percona-Server-client-56-5.6.43-rel84.3.el7.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Percona

解決:yum update percona-release

然後再執行一遍步驟1

2,安裝qpress

yum -y install qpress

3執行以下命令就可以得到資料表了。(backup.xb是我的‘.xb’檔名,/root/data為檔案所在路徑)

xbstream -x -C /root/data < ~/backup.xb

4.使用 qpress 命令將目標目錄下所有以.qp結尾的檔案都解壓出來

xtrabackup --decompress --target-dir=/root/data

5.備份解壓出來之後,需要執行以下命令進行 apply log 操作

xtrabackup --prepare  --target-dir=/root/data

這樣就得到原如資料庫檔案了

其它可以參考以下連結

https://cloud.tencent.com/document/product/236/33363#.E5.90.AF.E5.8A.A8-mysqld-.E8.BF.9B.E7.A8.8B.E5.B9.B6.E7.99.BB.E5.BD.95.E9.AA.8C.E8.AF.81