xtrabackup备份与恢复

XtraBackup备份

innobackupex -S/tmp/mysql3306.sock -uroot -pmysql /data/backup/
xtrabackup –backup -S /tmp/mysql3306.sock -uroot -pmysql –target-dir=/daba/backup
innobackupex –apply-log /data/backup/db-full-20170614/

xtrabackup恢复

  1. 需要恢复的地方MySQL需要关闭;
  2. 当前datadir为空;
  3. 手工把apply log过的文件copy过去,或者
    innobackupex –defaults-file=/data/mysql/mysql3306/my3306.cnf –copy-back /data/backup/db-full-20170614/
  4. 更改copy过去的文件的权限
    chown -R mysql:mysql /data/mysql/mysql3306/data
  5. 启动MySQL
    /usr/local/mysql/bin/mysqld–defaults-file=/data/mysql/mysql3306/my3306.cnf &

你可能感兴趣的:(xtrabackup备份与恢复)