mysql database backup and restore backup files .xb

 Today an old friend told me that his .xb mysql backup file extension can not be restored, or restore them only table no data, so I decided to try to conduct some backup and restore, in the online search, I have a document Tencent cloud, according to Tencent Come on cloud 

 First of all

Unpack backup file

    1. Since the compressed backup files to go through qpress, after xbstream package (xbstream as Percona a packing / unpacking tool), so after downloading the backup files, you should use xbstream to unpack it. xbstream Percona XtraBackup tool can be downloaded through the official website or download binary packages.

 

 After the election, the corresponding system version, select line installation

yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm
yum install percona-xtrabackup-24

  In fact, the above two commands, the installation is complete

 1. After installing XtraBackup, use xbstream command to unpack the backup file to the target directory.

xbstream -x -C / data <./test.xb / data file is restored, data name test.xb

 

 

   2. Use qpress command to the target directory with all .qpfiles are decompressed at the end of it.

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

3.Prepare backup file

After backup unzipped, you need to execute the following command to apply log operation.

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

At this folder as follows  

 

 

Modify the configuration file

Since version problems, please unzip the file backup-my.cnf following parameters commented out.

  • innodb_checksum_algorithm
  • innodb_log_checksum_algorithm
  • innodb_fast_checksum
  • innodb_page_size
  • innodb_log_block_size
  • redo_log_version

 

 

Modify file attributes

Modify file properties, and check the file belongs to mysql user.

chown -R mysql:mysql /data

Start mysqld process and login authentication

  1. Start mysqld process.
    mysqld_safe --defaults-file=/data/backup-my.cnf --user=mysql --datadir=/data &

     Here to explain, I commond not found error when using mysqld_safe, so I'll just use mysqld specific differences between Baidu please

    2. mysql client login authentication.

    mysql  -uroot -p  

     


    这里我没有拿到 root 账户密码 没办法设置远程登录 于是我直接使用mysqldump 把需要的数据库进行导成sql ,然后在本地导入sql 正常
    腾讯说明文档https://cloud.tencent.com/document/product/236/33363

 

Guess you like

Origin www.cnblogs.com/tongcharge/p/11600594.html