简体   繁体   中英

Mysql Percona backup is shutting down the mysql instance

I am running a basic back of my mysql database. I am unsure why it's shutting down. I am getting the backup completed message and I am getting completed after the prepare. But the instance still crashes. I am running two instances only I am backing up one.

xtrabackup --defaults-file=/etc/alternatives/my.cnf --defaults-group=mysqld5 --socket=/var/run/mysqld/db5.sock --user=mysqladmin --password=password --backup --throttle 400 --target-dir=/mysqlbackup/current --no-timestamp 2> /var/backup.log;

I cat the log file to make sure it completed and it does complete. I then run prepare

xtrabackup --prepare --use-memory=5G --target-dir=/mysqlbackup/current 2 >> /var/backup.log;

My log file has

xtrabackup: cd to /mysqlbackup/current
xtrabackup: This target seems to be not prepared yet.                                                                                                                                                                                                                                                                                                                           

Doing recovery: scanned up to log sequence number 5642017177088 (8%)
Doing recovery: scanned up to log sequence number 5642076559654 (99%)
Database was not shutdown normally
Starting crash recovery
Progress in percent: 0 1 2 ... 99
Apply batch completed
InnoDB: 96 redo rollback segment(s) found. 1 redo rollback segment(s) are active.                                                                                                                                                                                                                                                                                                
InnoDB: 32 non-redo rollback segment(s) are active.                                                                                                                                                                                                                                                                                                                              
InnoDB: page_cleaner: 1000ms intended loop took 748935ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.)                                                                                                                                                                                                                                         
InnoDB: 5.7.26 started; log sequence number 5642076559654 
xtrabackup: Last MySQL binlog file position 7017599, file name binlog.000009
xtrabackup: Recovered WSREP position: febfad99-09fe-11ea-ad83-57c73422d738:27384750                                                                                                                                                                                                                                                                                              
xtrabackup: starting shutdown with innodb_fast_shutdown = 1                                                                                                                                                                                                                                                                                                                      
InnoDB: FTS optimize thread exiting.                                                                                                                                                                                                                                                                                                                                             
InnoDB: Starting shutdown...                                                                                                                                                                                                                                                                                                                                                     
InnoDB: Shutdown completed; log sequence number 5642076561674                                                                                                                                                                                                                                                                                                                    
InnoDB: Number of pools: 1                                      
xtrabackup:   innodb_data_home_dir = . 
InnoDB: New log files created, LSN=5642076561674
InnoDB: Doing recovery: scanned up to log sequence number 5642076561941 (0%) 
InnoDB: Database was not shutdown normally! 
InnoDB: Starting crash recovery
InnoDB: Starting shutdown...                                                                                                                                                                                                                                                                                                                                                     
InnoDB: Shutdown completed; log sequence number 5642076561960                                                                                                                                                                                                                                                                                                                    
200213 08:05:36 completed OK!  

Connect to your running MySQL Server, and run this in the client:

mysql> SHOW STATUS LIKE 'Uptime';
+---------------+--------+
| Variable_name | Value  |
+---------------+--------+
| Uptime        | 268121 |
+---------------+--------+

The value is the number of seconds since your MySQL Server last started (the example I show above is from mysql on my own laptop, and works out to 74 hours, which is the last time I rebooted).

I think you'll find your value of uptime indicates your MySQL Server has been running fine through the time of your backup.

Percona XtraBackup does not restart your MySQL Server. It restarts its own InnoDB engine, to simulate crash recovery against the files it just backed up.

XtraBackup uses a lot of code that is borrowed from the InnoDB engine in MySQL itself, so it maintains compatibility with the format of InnoDB files. It uses the crash-recovery feature of InnoDB to "prepare" its copies of InnoDB files, to resolve any unfinished transactions.

By borrowing the code from the InnoDB engine, it outputs similar messages.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM