当前位置:网站首页>Xtrabackup for data backup

Xtrabackup for data backup

2022-06-24 08:39:00 An unreliable programmer

xtrabackup

XtraBackup(PXB) The tool is Percona Company use perl One of the tools of language development is for MySQL Backup tool for physical hot backup of database , Support MySQl(Oracle)、Percona Server and MariaDB, And all open source , It's the conscience of the industry . Ali's RDS MySQL Physical backup is based on this tool . Because it is backed up by physical copy , So it's very fast , Dozens of G The data is done in a few minutes , And it cleverly uses mysql Features to achieve online hot backup , You don't have to shut down the database like you used to do a physical backup , The full backup and incremental backup of the whole database or part of the database can be completed directly online .

install

  1. Installation warehouse Install the Percona repository
    yum install http://www.percona.com/downloads/percona-release/redhat/0.1-6/percona-release-0.1-6.noarch.rpm

  2. Test whether the warehouse contains the latest version of resources
    yum list | grep percona

  3. install packages
    yum install percona-xtrabackup-24

The data backup

  1. Full volume backup
    innobackupex ----defaults-file=/etc/my.cnf --user=root --password=root /root/back

Data recovery

  1. Shut down the database service
    service mysql stop

  2. Execute the data recovery command *( Be careful my.cnf Internally configured datadir Directory must be an empty directory , So before restoring data , First datadir To another directory , Then create an empty directory and perform the recovery )
    innobackupex --defaults-file=/etc/my.cnf --copy-back --rsync /path/to/backup

  3. Change permissions for the newly created directory
    chown -R mysql. /app/mysql/data

  4. start-up mysql service
    service mysql start

原网站

版权声明
本文为[An unreliable programmer]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206240612376050.html