Xtrabackup Backup from library, build new from library

Source: Internet
Author: User


(1) Parameter understanding
Built by M-s M-2s

--slave-info, prints the location of the binary log and the master server name, and writes to Xtrabackup_slave_info in the way of Change master.

--safe-slave-backup, to keep the replication state consistent, this option closes the slave SQL thread and waits until slave_open_temp_tabls in show status to start the backup. If the waiting time exceeds-safe-slave-backup-timeout, it will be reported
Wrong default 300 seconds. Slave SQL thread starts automatically after the backup is successful.


(2) master-from, back up the database from the library, a new master library from the library

10.10.6.87 DG2 Master
10.10.6.86 DG from
10.10.6.90 DGT from


10.10.6.87 Master information for the main library

Mysql> Show master Status \g;
1. Row ***************************
file:mysql-bin.000025
position:1046
binlog_do_db:
Binlog_ignore_db:mysql,information_schema
Executed_gtid_set:
1 row in Set (0.00 sec)


10.10.6.86 Master information from the library:
Mysql> Show master Status \g;
1. Row ***************************
file:mysql-bin.000019
position:680
binlog_do_db:
Binlog_ignore_db:mysql,information_schema
Executed_gtid_set:
1 row in Set (0.00 sec)




10.10.6.86 information from the library:
Mysql> show slave status \g;
1. Row ***************************
Slave_io_state:waiting for Master to send event
master_host:10.10.6.87
Master_user:rep
master_port:3306
Connect_retry:60
master_log_file:mysql-bin.000025
read_master_log_pos:1046
relay_log_file:mysql-bin.000021
relay_log_pos:1436
relay_master_log_file:mysql-bin.000025
Slave_io_running:yes
Slave_sql_running:yes
replicate_do_db:
Replicate_ignore_db:mysql
Replicate_do_table:
Replicate_ignore_table:
Replicate_wild_do_table:
Replicate_wild_ignore_table:
last_errno:0
Last_error:
skip_counter:0
exec_master_log_pos:1522
relay_log_space:1637
Until_condition:none
Until_log_file:
until_log_pos:0
Master_ssl_allowed:no
Master_ssl_ca_file:
Master_ssl_ca_path:
Master_ssl_cert:
Master_ssl_cipher:
Master_ssl_key:
seconds_behind_master:0
Master_ssl_verify_server_cert:no
last_io_errno:0
Last_io_error:
last_sql_errno:0
Last_sql_error:
Replicate_ignore_server_ids:
Master_server_id:2
Master_uuid:8f9e146f-0a18-11e7-810a-0050568833c8
Master_info_file:/var/lib/mysql/master.info
sql_delay:0
Sql_remaining_delay:null
Slave_sql_running_state:slave has read all relay log; Waiting for more updates
master_retry_count:86400
Master_bind:
Last_io_error_timestamp:
Last_sql_error_timestamp:
MASTER_SSL_CRL:
Master_ssl_crlpath:
Retrieved_gtid_set:
Executed_gtid_set:
auto_position:0
replicate_rewrite_db:
Channel_name:
Master_tls_version:
1 row in Set (0.00 sec)

Back up the entire library on the standby
[ROOT@DG backup]# Innobackupex--defaults-file=/etc/my.cnf--user=backup--password= ' bc.123456 '--socket=/var/lib/ Mysql/mysql.sock--slave-info--safe-slave-backup--no-timestamp/backup/full


Back up the recovery log on the source library
After the backup is completed, it cannot be used for recovery, some uncommitted things need to be restored, the redo logo data needs to be restored, and the data is consistent.
[ROOT@DG backup]# Innobackupex--apply-log/backup/full


Transferring data to a new backup repository
[ROOT@DG backup]# scp-r full/dgt:/backup/


(3) Clean up the directory in the new S recovery machine
Service Mysqld Stop
Mv/var/lib/mysql/var/lib/mysql6


(4) Copy data file to directory:
Innobackupex--defaults-file=/etc/my.cnf--copy-back--rsync/backup/full


[Root@dgt mysql]# chown-r Mysql.mysql/var/lib/mysql
[ROOT@DGT lib]# Service mysqld start
[Root@dgt lib]# Cd/backup/full
[Root@dgt full]# Cat Xtrabackup_slave_info
Change MASTER to master_log_file= ' mysql-bin.000025 ', master_log_pos=1046


(5) Modify the checkpoint location from the library
Change MASTER to master_host= ' 10.10.6.87 ', master_port=3306, master_user= ' rep ', master_password= ' bc.123456 ', master_ Log_file= ' mysql-bin.000025 ', master_log_pos=1046;


Start slave;

Users on the main library
GRANT REPLICATION SLAVE on *.* to ' rep ' @ ' 10.10.6.% ' identified by ' bc.123456 ';


(6) View status
Mysql> show slave status \g;
1. Row ***************************
Slave_io_state:waiting for Master to send event
master_host:10.10.6.87
Master_user:rep
master_port:3306
Connect_retry:60
master_log_file:mysql-bin.000025
read_master_log_pos:1046
relay_log_file:mysql-bin.000003
relay_log_pos:320
relay_master_log_file:mysql-bin.000025
Slave_io_running:yes
Slave_sql_running:yes
replicate_do_db:
Replicate_ignore_db:mysql,information_schema
Replicate_do_table:
Replicate_ignore_table:
Replicate_wild_do_table:
Replicate_wild_ignore_table:
last_errno:0
Last_error:
skip_counter:0
exec_master_log_pos:1046
relay_log_space:521
Until_condition:none
Until_log_file:
until_log_pos:0
Master_ssl_allowed:no
Master_ssl_ca_file:
Master_ssl_ca_path:
Master_ssl_cert:
Master_ssl_cipher:
Master_ssl_key:
seconds_behind_master:0
Master_ssl_verify_server_cert:no
last_io_errno:0
Last_io_error:
last_sql_errno:0
Last_sql_error:
Replicate_ignore_server_ids:
Master_server_id:2
Master_uuid:8f9e146f-0a18-11e7-810a-0050568833c8
Master_info_file:/var/lib/mysql/master.info
sql_delay:0
Sql_remaining_delay:null
Slave_sql_running_state:slave has read all relay log; Waiting for more updates
master_retry_count:86400
Master_bind:
Last_io_error_timestamp:
Last_sql_error_timestamp:
MASTER_SSL_CRL:
Master_ssl_crlpath:
Retrieved_gtid_set:
Executed_gtid_set:
auto_position:0
replicate_rewrite_db:
Channel_name:
Master_tls_version:
1 row in Set (0.00 sec)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.