Command to back up a database and restore database through innobackupex

93 views
Skip to first unread message

lzm9...@gmail.com

unread,
Jun 12, 2018, 9:39:50 AM6/12/18
to Percona Discussion
通过innobackupex备份数据库和恢复数据库的命令

Sym

unread,
Jun 12, 2018, 9:48:33 AM6/12/18
to Percona Discussion
may I know what is exactly that you want to do?

On Tuesday, June 12, 2018 at 9:39:50 PM UTC+8, lzm9...@gmail.com wrote:
通过innobackupex备份数据库和恢复数据库的命令

George Chilumbu

unread,
Dec 27, 2018, 4:19:06 AM12/27/18
to Percona Discussion

George Chilumbu

unread,
Dec 27, 2018, 4:21:33 AM12/27/18
to Percona Discussion

  

 1. Create Backup using Percona Xtrabackup

 

innobackupex --user=root --password=backpassword --host=localhost /tmp/ 

 

NOTE: Lets assume the command above creates a backup called /tmp/2018-12-07_03-09-06

 

2. Prepare backup

sudo innobackupex --apply-log --use-memory=2G /tmp/2018-12-07_03-09-06

 

3. Transfer backup folder to remote slave server.

scp -rC /tmp/2018-12-07_03-09-06  remote-db-server:/tmp

   

 

4. Perform Restoration on Remote Server

service mysql stop

mv /var/lib/mysql /tmp/mysql-old

mv /tmp/2018-12-07_03-09-06 /var/lib/mysql

chmod 755 /var/lib/mysql

chown mysql:mysql -R /var/lib/mysql

 

5. Create /var/lib/mysql/grastate.dat config file

vim /var/lib/mysql/grastate.dat

sudo chown mysql:mysql -R /var/lib/mysql/grastate.dat

 

NOTE: add contents to the newly created grastate.dat file from the grastate.dat copy on the MySQL Server where the backup was originally performed.

 

 

6. Update newly created grastate.dat seqno value.

cat /var/lib/mysql/xtrabackup_galera_info  # copy seqno i.e., digit after ":" e.g, 88103385 from the results below:

9bda690c-d24d-11e6-8944-46d5e753f4b1:88103385

 

7. Start MySQL

service mysql start

George Chilumbu

unread,
Dec 27, 2018, 4:22:31 AM12/27/18
to Percona Discussion
You can also follow the post here which explains in more detail:

Reply all
Reply to author
Forward
0 new messages