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

Xtrabackup2.4 backup recovery script

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

Share

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

Xtrabackup shell script:

Https://gitee.com/ygqygq2/mytools/tree/master/xtrabackup

1. instructions

This script is based on Percona XtraBackup 2.4

two。 Backup user permissions

Under the root user of mysql, create the user and give the following permissions

GRANT SUPER, RELOAD, LOCK TABLES, PROCESS, REPLICATION CLIENT ON *. * TO 'xtrabackup'@'localhost' identified by' 12345678'

If there is no SUPER permission, the following error will occur in the incremental backup Times

Error: failed to execute query FLUSH NO_WRITE_TO_BINLOG CHANGED_PAGE_BITMAPS: Access denied; you need (at least one of) the SUPER privilege (s) for this operation

Write the password used by the backup to the following file because the script reads the password in this file.

Mkdir-p / data/save/echo '12345678' > / data/save/mysql_xtrabackup3. Instructions for using the script

The script uses scenarios to back up multiple times a day.

Xtrabackup_backup_mysql.sh # script Control entry xtrabackup_backup_full.sh # full backup script xtrabackup_backup_incremental.sh # incremental backup script xtrabackup_backup_restore.sh # backup recovery script 4. Xtrabackup key parameters description

In xtrabackup-- prepare, if you do not use-- apply-log-only to prevent database rollback, then your incremental backup will be useless. Because further incremental backups cannot be applied after the transaction is rolled back.

-- apply-log-only should merge all incremental backups except the last incremental backup, which is why the last incremental backup xtrabackup-- prepare does not use it in the restore backup script. Even if-- apply-log-only is used at the last incremental backup, the backup will still be consistent, but in this case, the database will have a phase to perform a rollback.

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