Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Introduction to XtraBackup installation and backup in MySQL

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Next, let's learn about the installation and backup of XtraBackup in MySQL. I believe you will benefit a lot after reading it. The text is not much in essence. I hope you want XtraBackup installation and backup in MySQL.

Note: install XtraBackup first

Download address: https://www.percona.com/downloads/XtraBackup/LATEST/

My version here is: percona-xtrabackup-24-2.4.6-2.el7.x86_64.rpm

Local installation: yum localinstall percona-xtrabackup-24-2.4.6-2.el7.x86_64.rpm

View

OK, installation complete

I. complete and recovery of XtraBackup

1. Create a backup user and authorize

Create user' bkuser'@'localhost' identified by '123456'

Grant reload,lock tables,process,replication client on *. * to 'bkuser'@'localhost'

Flush privileges

two。 Start backup

Innobackupex-user=bkuser--password=123456 / data/backup/

Except for errors when backing up, the reason is that the socket file was not found.

Backup completed, successful!

Backed up files:

3. Backup and recovery

Suppose we delete the previous data file and restore it directly (stop the MySQL service first)

First innobackupex-- apply-log / data/backup/2017-04-18 20-35-51 /

Then innobackupex-- copy-back / data/backup/2017-04-18 20-35-51 /

The restore was successful. Restart MySQL

two. Incremental backup and recovery

1. Full backup, but do not use apply-log first

2. Perform incremental backup on the basis of full backup

Add a record first

Start the first incremental backup innobackupex-user=bkuser-password=123456-socket=/tmp/mysql.sock-incremental / data/backup/db-incre-20170418-1-incremental-basedir=/data/backup/20170418full

Backup succeeded

Insert a piece of data again for a second incremental backup

Innobackupex-user=bkuser-password=123456-socket=/tmp/mysql.sock-no-timestamp-incremental / data/backup/db-incre-20170418-2-incremental-basedir=/data/backup/db-incre-20170418-1

The second incremental backup is complete

3. Restore backup data

1) full recovery for the first time + incremental recovery for the first time (under full backup and first incremental backup)

Innobackupex-apply-log-redo-only / data/backup/20170418full

Innobackupex-apply-log-redo-only / data/backup/20170418full-incremental-dir=/data/backup/db-incre-20170418-1

Innobackupex-apply-log / data/backup/20170418full

Theoretically, the recovered data is eight.

Innobackupex-copy-back / data/backup/20170418full

Similarly, stop MySQL and delete the previous data, create a data folder and authorize

2) restore full and two incremental backups

Innobackupex-apply-log-redo-only / data/backup/20170418full

Innobackupex-apply-log-redo-only / data/backup/20170418full-incremental-dir=/data/backup/db-incre-20170418-1

Innobackupex-apply-log-redo-only / data/backup/20170418full-incremental-dir=/data/backup/db-incre-20170418-2

Innobackupex-apply-log / data/backup/20170418full

Turn off MySQL and delete data

Restore data innobackupex-copy-back / data/backup/20170418full

Restart MySQL to see the data

Incremental backup restore complete!

After reading this article on XtraBackup installation and backup in MySQL, many readers will want to know more about it. For more industry information, you can follow our industry information section.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report