Preface
 
    In my previous blogs,I've demonstrated several mothods of how to rescue a dropped table(or truncated table as well).
  •     full mysqldump backup + binlog on master(master was normally running)
  •     full Xtrabackup backup + binlog on master(master was normally running)
  •     full Xtrabackup backup + binlog on binlog server( binlog server had acquired binlogs before master crashed.)
 
    Les't see another way to achieve the goal more simply.
 
Procedure
 
Step 1. Destroy
 
Check the table on master.
 (zlm@192.168.1.101 )[sysbench]>show tables;
ERROR (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:
Current database: sysbench +--------------------+
| Tables_in_sysbench |
+--------------------+
| sbtest1 |
| sbtest2 |
| sbtest3 |
| sbtest4 |
| sbtest5 |
+--------------------+
rows in set (0.00 sec) (zlm@192.168.1.101 )[sysbench]>select count(*) from sbtest5;
+----------+
| count(*) |
+----------+
| |
+----------+
row in set (0.01 sec)
Generate a full Xtrabackup of master.
 [root@zlm2 :: /data/mysql/mysql3306/data]
#innobackupex --default-file=/data/mysql/mysql3306/my.cnf --host=localhost -uroot -pPassw0rd /data/backup
xtrabackup: recognized server arguments:
xtrabackup: recognized client arguments:
:: innobackupex: Starting the backup operation
... //Omitted. :: Executing UNLOCK TABLES
:: All tables unlocked
:: [] Copying ib_buffer_pool to /data/backup/--31_06--/ib_buffer_pool
:: [] ...done
:: Backup created in directory '/data/backup/2018-07-31_06-29-03/'
MySQL binlog position: filename 'mysql-bin.000043', position '', GTID of the last change '1b7181ee-6eaf-11e8-998e-080027de0e0e:1-3730229'
:: [] Writing /data/backup/--31_06--/backup-my.cnf
:: [] ...done
:: [] Writing /data/backup/--31_06--/xtrabackup_info
:: [] ...done
xtrabackup: Transaction log of lsn () to () was copied.
:: completed OK!
Continue to executing some dml operations on the target table and then kill the mysqld.
 (zlm@192.168.1.101 )[sysbench]>delete from sbtest5 limit ;
Query OK, rows affected (0.10 sec) (zlm@192.168.1.101 )[sysbench]>delete from sbtest5 limit ;
Query OK, rows affected (0.07 sec) (zlm@192.168.1.101 )[sysbench]>select count(*) from sbtest5;
+----------+
| count(*) |
+----------+
| |
+----------+
row in set (0.00 sec) (zlm@192.168.1.101 )[sysbench]>drop table sbtest5;
Query OK, rows affected (0.01 sec) (zlm@192.168.1.101 )[sysbench]>flush logs;
Query OK, rows affected (0.02 sec) (zlm@192.168.1.101 )[sysbench]>show master status;
+------------------+----------+--------------+------------------+------------------------------------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+------------------------------------------------+
| mysql-bin. | | | | 1b7181ee-6eaf-11e8-998e-080027de0e0e:- |
+------------------+----------+--------------+------------------+------------------------------------------------+
row in set (0.00 sec) [root@zlm2 :: ~]
#pkill mysqld [root@zlm2 :: ~]
#ps aux|grep mysqld
root 0.0 0.0 pts/ R+ : : grep --color=auto mysqld
Scp the Xtrabackup backup to another server zlm3 with newly initialized instance
 [root@zlm2 :: ~]
#scp -r /data/backup/--31_06--/ zlm3:/data/backup
root@zlm3's password:
xtrabackup_logfile % .5KB/s :
ibdata1 % 100MB .0MB/s :
plugin.ibd % 96KB .0KB/s :
servers.ibd % 96KB .0KB/s :
... //Omitted.
Step 2. Rescue
 
Restore the backup on zlm3.
 [root@zlm3 :: ~]
#innobackupex --defaults-file=/data/mysql/mysql3306/my.cnf --apply-log /data/backup/--31_06--/
... //Omitted. [root@zlm3 :: ~]
#cd /data/mysql/mysql3306/data/ [root@zlm3 :: /data/mysql/mysql3306/data]
#ls -l
total
-rw-r----- mysql mysql Jul : auto.cnf
-rw-r----- mysql mysql Jul : error.log
-rw-r----- mysql mysql Jul : ib_buffer_pool
-rw-r----- mysql mysql Jul : ibdata1
-rw-r----- mysql mysql Jul : ib_logfile0
-rw-r----- mysql mysql Jul : ib_logfile1
-rw-r----- mysql mysql Jul : ib_logfile2
drwxr-x--- mysql mysql Jul : mysql
drwxr-x--- mysql mysql Jul : performance_schema
-rw-r----- mysql mysql Jul : relay-bin.
-rw-r----- mysql mysql Jul : relay-bin.
-rw-r----- mysql mysql Jul : relay-bin.
-rw-r----- mysql mysql Jul : relay-bin.
-rw-r----- mysql mysql Jul : relay-bin.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_applier.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_applier.index
-rw-r----- mysql mysql Jul : relay-bin-group_replication_recovery.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_recovery.index
-rw-r----- mysql mysql Jul : relay-bin.index
-rw-r----- mysql mysql Jul : slow.log
drwxr-x--- mysql mysql Jul : sys
drwxr-x--- mysql mysql Jul : sysbench
-rw-r----- mysql mysql Jul : xtrabackup_binlog_pos_innodb
-rw-r----- mysql mysql Jul : xtrabackup_info
-rw-r----- mysql mysql Jul : xtrabackup_master_key_id [root@zlm3 :: /data/mysql/mysql3306/data]
#rm -rf * [root@zlm3 :: /data/mysql/mysql3306/data]
#ps aux|grep mysqld
root 0.0 0.0 pts/ R+ : : grep --color=auto mysqld [root@zlm3 :: ~]
#innobackupex --defaults-file=/data/mysql/mysql3306/my.cnf --copy-back /data/backup/--31_06--/
... //Omitted. :: [] Copying ./ib_buffer_pool to /data/mysql/mysql3306/data/ib_buffer_pool
:: [] ...done
:: [] Copying ./xtrabackup_info to /data/mysql/mysql3306/data/xtrabackup_info
:: [] ...done
:: [] Copying ./xtrabackup_binlog_pos_innodb to /data/mysql/mysql3306/data/xtrabackup_binlog_pos_innodb
:: [] ...done
:: [] Copying ./xtrabackup_master_key_id to /data/mysql/mysql3306/data/xtrabackup_master_key_id
:: [] ...done
:: [] Copying ./ibtmp1 to /data/mysql/mysql3306/data/ibtmp1
:: [] ...done
:: completed OK! [root@zlm3 :: /data/mysql/mysql3306/data]
#ls -l
total
-rw-r----- root root Jul : ib_buffer_pool
-rw-r----- root root Jul : ibdata1
-rw-r----- root root Jul : ib_logfile0
-rw-r----- root root Jul : ib_logfile1
-rw-r----- root root Jul : ib_logfile2
-rw-r----- root root Jul : ibtmp1
drwxr-x--- root root Jul : mysql
drwxr-x--- root root Jul : performance_schema
drwxr-x--- root root Jul : sys
drwxr-x--- root root Jul : sysbench
-rw-r----- root root Jul : xtrabackup_binlog_pos_innodb
-rw-r----- root root Jul : xtrabackup_info
-rw-r----- root root Jul : xtrabackup_master_key_id
drwxr-x--- root root Jul : zlm [root@zlm3 :: /data/mysql/mysql3306/data]
#chown -R mysql.mysql *
Startup the MySQL instance on zlm3.
 [root@zlm3 :: /data/mysql/mysql3306/data]
#sh /root/mysqld.sh [root@zlm3 :: /data/mysql/mysql3306/data]
#ps aux|grep mysqld
mysql 20.0 17.7 pts/ Sl : : mysqld --defaults-file=/data/mysql/mysql3306/my.cnf
root 0.0 0.0 pts/ R+ : : grep --color=auto mysqld [root@zlm3 :: /data/mysql/mysql3306/data]
#mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.7.-log MySQL Community Server (GPL) Copyright (c) , , Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. (zlm@192.168.1.102 )[(none)]>select count(*) from sysbench.sbtest5;
+----------+
| count(*) |
+----------+
| |
+----------+
row in set (0.02 sec)
    The data in Xtrabackup of master has been restored on zlm3. Notice,it doesn't contain the operations of deletion 5000 rows. Firstly,I supposed that the mysqld has crashed and it can never start again. Secondly,I don't have binlog server any more this time.Is there any other way to restore the dropping table and guarantee the change will not lose on it?How can we restore the data safely and simply?Surely there is.
    Even thought the mysqld process is down on master.I still can get the binlog files on it.How about change the master binlog files into relay log files and apply them on zlm3?Let's have a try.
 
Step 3. Special technique
 
Make sure which binlogs we need and copy them to zlm3.
 [root@zlm3 :: /data/backup/--31_06--]
#cat xtrabackup_binlog_info
mysql-bin. 1b7181ee-6eaf-11e8-998e-080027de0e0e:- //It means that the binlog we need should begin from mysql-bin.000043. [root@zlm2 :: /data/mysql/mysql3306/data]
#cd ../logs [root@zlm2 :: /data/mysql/mysql3306/logs]
#ls -l
total
-rw-r----- mysql mysql Jul : mysql-bin.
-rw-r----- mysql mysql Jul : mysql-bin.
-rw-r----- mysql mysql Jul : mysql-bin.
-rw-r----- mysql mysql Jul : mysql-bin.
-rw-r----- mysql mysql Jul : mysql-bin.
-rw-r----- mysql mysql Jul : mysql-bin.
-rw-r----- mysql mysql Jul : mysql-bin.
-rw-r----- mysql mysql Jul : mysql-bin.
-rw-r----- mysql mysql Jul : mysql-bin.
-rw-r----- mysql mysql Jul : mysql-bin.
-rw-r----- mysql mysql Jul : mysql-bin.
-rw-r----- mysql mysql Jul : mysql-bin.
-rw-r----- mysql mysql Jul : mysql-bin.
-rw-r----- mysql mysql Jul : mysql-bin.
-rw-r----- mysql mysql Jul : mysql-bin.
-rw-r----- mysql mysql Jul : mysql-bin.
-rw-r----- mysql mysql Jul : mysql-bin.
-rw-r----- mysql mysql Jul : mysql-bin.
-rw-r----- mysql mysql Jul : mysql-bin.
-rw-r----- mysql mysql Jul : mysql-bin.
-rw-r----- mysql mysql Jul : mysql-bin.
-rw-r----- mysql mysql Jul : mysql-bin.
-rw-r----- mysql mysql Jul : mysql-bin.index [root@zlm2 :: /data/mysql/mysql3306/logs]
#scp mysql-bin.{,} zlm3:/data/backup root@zlm3's password:
mysql-bin. % 932KB .1KB/s :
mysql-bin. % .2KB/s :
Transfer the mysql-bin files into relay-bin files.
 [root@zlm3 :: /data/backup/--31_06--]
#cd .. [root@zlm3 :: /data/backup]
#ls -l
total
drwxr-x--- root root Jul : --31_06--
-rw-r----- root root Jul : mysql-bin.
-rw-r----- root root Jul : mysql-bin. [root@zlm3 :: /data/backup]
#for i in $(ls mysql-bin.*)
> do
> ext=$(echo $i | cut -d'.' -f2);
> cp $i relay-bin.$ext;
> done [root@zlm3 :: /data/backup]
#ls -l
total
drwxr-x--- root root Jul : --31_06--
-rw-r----- root root Jul : mysql-bin.
-rw-r----- root root Jul : mysql-bin.
-rw-r----- root root Jul : relay-bin.
-rw-r----- root root Jul : relay-bin. [root@zlm3 :: /data/backup]
#ls ./relay-bin.* > relay-bin.index [root@zlm3 :: /data/backup]
#ls -l
total
drwxr-x--- root root Jul : --31_06--
-rw-r----- root root Jul : mysql-bin.
-rw-r----- root root Jul : mysql-bin.
-rw-r----- root root Jul : relay-bin.
-rw-r----- root root Jul : relay-bin.
-rw-r--r-- root root Jul : relay-bin.index [root@zlm3 :: /data/backup]
#cat relay-bin.index
./relay-bin.
./relay-bin. [root@zlm3 :: /data/backup]
#chown mysql.mysql relay* [root@zlm3 :: /data/backup]
#ls -l
total
drwxr-x--- root root Jul : --31_06--
-rw-r----- root root Jul : mysql-bin.
-rw-r----- root root Jul : mysql-bin.
-rw-r----- mysql mysql Jul : relay-bin.
-rw-r----- mysql mysql Jul : relay-bin.
-rw-r--r-- mysql mysql Jul : relay-bin.index
Copy these relay-bin files to the proper directory.
 [root@zlm3 :: /data/backup]
#cp relay* /data/mysql/mysql3306/data [root@zlm3 :: /data/backup]
#cd /data/mysql/mysql3306/data [root@zlm3 :: /data/mysql/mysql3306/data]
#ls -l|grep relay
-rw-r----- root root Jul : relay-bin. //Notice,the owner and group has been changed.
-rw-r----- root root Jul : relay-bin.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_applier.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_applier.index
-rw-r----- mysql mysql Jul : relay-bin-group_replication_recovery.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_recovery.index
-rw-r--r-- root root Jul : relay-bin.index [root@zlm3 :: /data/mysql/mysql3306/data]
#chown mysql.mysql relay* [root@zlm3 :: /data/mysql/mysql3306/data]
#ls -l|grep relay
-rw-r----- mysql mysql Jul : relay-bin.
-rw-r----- mysql mysql Jul : relay-bin.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_applier.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_applier.index
-rw-r----- mysql mysql Jul : relay-bin-group_replication_recovery.
-rw-r----- mysql mysql Jul : relay-bin-group_replication_recovery.index
-rw-r--r-- mysql mysql Jul : relay-bin.index
Restart the mysqld process.
 [root@zlm3 :: /data/mysql/mysql3306/data]
#mysqladmin shutdown [root@zlm3 :: /data/mysql/mysql3306/data]
#ps aux|grep mysqld
root 0.0 0.0 pts/ R+ : : grep --color=auto mysqld [root@zlm3 :: /data/mysql/mysql3306/data]
#sh /root/mysqld.sh [root@zlm3 :: /data/mysql/mysql3306/data]
#ps aux|grep mysqld
mysql 11.5 17.8 pts/ Sl : : mysqld --defaults-file=/data/mysql/mysql3306/my.cnf
root 0.0 0.0 pts/ R+ : : grep --color=auto mysqld
Check out the first consistent position we need.
 [root@zlm3 :: /data/backup/--31_06--]
#cat xtrabackup_binlog_info
mysql-bin. 1b7181ee-6eaf-11e8-998e-080027de0e0e:-
Execute "change master to" as below.
 (zlm@192.168.1.102 )[(none)]>change master to relay_log_file='relay-bin.000043',relay_log_pos=,master_host='xxx';
ERROR (HY000): Failed initializing relay log position: Could not find first log during relay log initialization
(zlm@192.168.1.102 )[(none)]>show master status;
+------------------+----------+--------------+------------------+------------------------------------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+------------------------------------------------+
| mysql-bin. | | | | 1b7181ee-6eaf-11e8-998e-080027de0e0e:- |
+------------------+----------+--------------+------------------+------------------------------------------------+
row in set (0.00 sec) (zlm@192.168.1.102 )[(none)]>reset master;
Query OK, rows affected (0.02 sec) (zlm@192.168.1.102 )[(none)]>show master status;
+------------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin. | | | | |
+------------------+----------+--------------+------------------+-------------------+
row in set (0.00 sec) (zlm@192.168.1.102 )[(none)]>set @@global.gtid_purged='1b7181ee-6eaf-11e8-998e-080027de0e0e:1-3730229';
Query OK, rows affected (0.01 sec) (zlm@192.168.1.102 )[(none)]>show master status;
+------------------+----------+--------------+------------------+------------------------------------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+------------------------------------------------+
| mysql-bin. | | | | 1b7181ee-6eaf-11e8-998e-080027de0e0e:- |
+------------------+----------+--------------+------------------+------------------------------------------------+
row in set (0.00 sec) (zlm@192.168.1.102 )[(none)]>change master to relay_log_file='relay-bin.000043',relay_log_pos=,master_host='xxx';
ERROR (HY000): Failed initializing relay log position: Could not find first log during relay log initialization (zlm@192.168.1.102 )[(none)]>show slave status\G
*************************** . row ***************************
Slave_IO_State:
Master_Host: xxx
Master_User: test
Master_Port:
Connect_Retry:
Master_Log_File:
Read_Master_Log_Pos:
Relay_Log_File: relay-bin.
Relay_Log_Pos:
Relay_Master_Log_File:
Slave_IO_Running: No
Slave_SQL_Running: No
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno:
Last_Error:
Skip_Counter:
Exec_Master_Log_Pos:
Relay_Log_Space:
Until_Condition: None
Until_Log_File:
Until_Log_Pos:
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno:
Last_IO_Error:
Last_SQL_Errno:
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id:
Master_UUID:
Master_Info_File: mysql.slave_master_info
SQL_Delay:
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State:
Master_Retry_Count:
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set: //No relay logs was retrieved here.
Executed_Gtid_Set: 1b7181ee-6eaf-11e8-998e-080027de0e0e:-
Auto_Position:
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
row in set (0.00 sec)
    I was stuck again,faint!T_T...
 
Supplemented on August 1.
 
    After discussing with my classmate Shuaibing Zhang,I found out that the reason why I got failure above was due to not executing "reset slave all;".Therefore,it meantioned that "Could not find the first log..." when I Executed "change master to ... ".
 
Execute "change master to ... "
 (zlm@192.168.1.102 )[(none)]>change master to relay_log_file='relay-bin.000043',relay_log_pos=,master_host='xxx';
Query OK, rows affected (0.01 sec) (zlm@192.168.1.102 )[(none)]>show slave status\G
*************************** . row ***************************
Slave_IO_State:
Master_Host: xxx
Master_User:
Master_Port:
Connect_Retry:
Master_Log_File:
Read_Master_Log_Pos:
Relay_Log_File: relay-bin.
Relay_Log_Pos:
Relay_Master_Log_File:
Slave_IO_Running: No
Slave_SQL_Running: No
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno:
Last_Error:
Skip_Counter:
Exec_Master_Log_Pos:
Relay_Log_Space:
Until_Condition: None
Until_Log_File:
Until_Log_Pos:
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno:
Last_IO_Error:
Last_SQL_Errno:
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id:
Master_UUID:
Master_Info_File: mysql.slave_master_info
SQL_Delay:
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State:
Master_Retry_Count:
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set: 1b7181ee-6eaf-11e8-998e-080027de0e0e:-
Auto_Position:
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
row in set (0.00 sec)

Analyze the relay-bin file to find out the until postion before dropping operation.

 [root@zlm3 :: /data/mysql/mysql3306/data]
#cd /data/backup/ [root@zlm3 :: /data/backup]
#mysqlbinlog --base64-output=decode-rows relay-bin. > .log [root@zlm3 :: /data/backup]
#tail - .log
# :: server id end_log_pos Delete_rows: table id flags: STMT_END_F
# at
# :: server id end_log_pos Xid =
COMMIT/*!*/;
# at
# :: server id end_log_pos GTID last_committed= sequence_number= rbr_only=no
SET @@SESSION.GTID_NEXT= '1b7181ee-6eaf-11e8-998e-080027de0e0e:3730232'/*!*/;
# at
# :: server id end_log_pos Query thread_id= exec_time= error_code=
use `sysbench`/*!*/;
SET TIMESTAMP=/*!*/;
DROP TABLE `sbtest5` /* generated by server */ //Here's the dropping operation.Therefore,the util position we need is "954251" which just below the "COMMIT/*!*/;"
/*!*/;
# at
# :: server id end_log_pos Rotate to mysql-bin. pos:
SET @@SESSION.GTID_NEXT= 'AUTOMATIC' /* added by mysqlbinlog */ /*!*/;
DELIMITER ;
# End of log file
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;

Execute start slave sql_thread util clause.

 (zlm@192.168.1.102 )[(none)]>start slave sql_thread until relay_log_file='relay-bin.000043',relay_log_pos=;
Query OK, rows affected (0.00 sec) (zlm@192.168.1.102 )[(none)]>show slave status\G
*************************** . row ***************************
Slave_IO_State:
Master_Host: xxx
Master_User:
Master_Port:
Connect_Retry:
Master_Log_File:
Read_Master_Log_Pos:
Relay_Log_File: relay-bin.
Relay_Log_Pos:
Relay_Master_Log_File:
Slave_IO_Running: No
Slave_SQL_Running: No
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno:
Last_Error:
Skip_Counter:
Exec_Master_Log_Pos:
Relay_Log_Space:
Until_Condition: Relay
Until_Log_File: relay-bin.
Until_Log_Pos:
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno:
Last_IO_Error:
Last_SQL_Errno:
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id:
Master_UUID:
Master_Info_File: mysql.slave_master_info
SQL_Delay:
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State:
Master_Retry_Count:
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set: 1b7181ee-6eaf-11e8-998e-080027de0e0e:-
Auto_Position:
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
row in set (0.00 sec) (zlm@192.168.1.102 )[(none)]>select count(*) from sysbench.sbtest5;
+----------+
| count(*) |
+----------+
| |
+----------+
row in set (0.01 sec)
Summary
 
The simply description of rescuing data with relay log method is shown below:
The precondition is that the master has a up-to-date full backup.(Xtrabackup or mysqldump)
1. Copy all the binlog files to another server which has a newly initialized instance.
2. Restore the backup on new instance and check data is restored normally.
3. Execute "reset slave all;" to clear the original replication information(restored from master).
4. Reconfigure those binlog files with "relay-bin.xxxxxx" format together with relay-bin.index file.
5. Copy those relay logs to the proper datadir and change the ownership and group of them.
6. Execute "change master to ... " with "relay_log_file" and "relay_log_pos".
7. Execute "change replication filter ... " if you're supposed to merely restore a single table.(optional)
8. Execute "start slave sql_thread until ... " to restore data until the position you need.(both relay_log_pos and sql_before_gtids is okay)

 

恢复误删除表黑科技之relay log大法的更多相关文章

  1. 恢复误删除表黑科技之relay log大法(续)

      Preface       I've stuck twice in my previous experiments in backing up dropped tables.I am still ...

  2. Oracle恢复误删除表操作语句

    一.表和数据恢复 1.从回收站里查询被删除的表 select object_name,original_name,partition_name,type,ts_name,createtime,drop ...

  3. windows黑科技-记录dns log

    昨天看到袁哥微博,看到了这篇,今天测试了一下,记录下来: The DNS Client service does not log by default. However, if a file name ...

  4. Oracle误删除表空间的恢复

    对于误删除表空间的恢复,本文通过基于数据库的时间点恢复和基于表空间的时间点恢复分别加以讨论 一 通过基于数据库的时间点恢复被误删除的表空间 1 需要注意的事项 a 基于数据库的时间点恢复将会回退整个数 ...

  5. rman恢复误删除的一张表(不完全恢复)

    恢复误删除的一张表可以使用很多方法,如日志挖掘.闪回等,rman恢复(不完全恢复)肯定不是最好的,也不建议用, 现在我们只是演示一下这种恢复. 1 RMAN备份数据库 2创建测试表 3查看此时的SCN ...

  6. ORACLE恢复误删除的对象(表、存储过程等)

    1.恢复存储过程 原理就是利用了oracle里所有的存储过程的源代码都是存在dba_source里,而drop某个存储过程的时候,oracle这里肯定要去dba_source里把相关的源代码给dele ...

  7. Oracle误删除表数据后的恢复具体解释

    Oracle误删除表数据后的恢复具体解释 測试环境: SYSTEM:IBM AIX 5L                         Oracle Version:10gR2 1. undo_re ...

  8. 利用flashBack恢复误删除(delete)的表数据

    Flashback query(闪回查询)原理 Oracle根据undo信息,利用undo数据,类似一致性读取方法,可以把表置于一个删除前的时间点(或SCN),从而将数据找回. Flashback q ...

  9. mysql relay log参数汇总

    前言:MySQL进行主主复制或主从复制的时候会在配置文件制定的目录下面产生相应的relay log,本文档总结这些相关参数的定义及解释. 1.什么是relay log The relay log, l ...

随机推荐

  1. MySQL入门很简单: 6 视图

    1. 视图含义作用 视图是虚拟的表,是从数据率中一个或多个表中导出来的表:  数据库中只存放了视图的定义,没有存放视图中的数据,数据在原先的表中:  一旦表中的数据发生变化,显示在视图中的数据也会发生 ...

  2. IOS 多线程-NSThread 和线程状态

    @interface HMViewController () - (IBAction)btnClick; @end @implementation HMViewController - (void)v ...

  3. 转:spring mvc返回json数据格式

    转:http://www.cnblogs.com/ssslinppp/p/4675495.html <Spring学习笔记-MVC>系列文章,讲解返回json数据的文章共有3篇,分别为: ...

  4. 创建git及其初始化

    创建一个版本库非常简单,首先,选择一个合适的地方,创建一个空目录: $ mkdir learngit $ cd learngit $ pwd /Users/michael/learngit 初始化一个 ...

  5. Large-scale Scene Understanding (LSUN)

    Large-scale Scene Understanding (LSUN) http://lsun.cs.princeton.edu/#organizers http://sunw.csail.mi ...

  6. Eclipse使用的小技巧

    1.在右键new菜单栏中添加新建JSP文件 window->perspective->customize perspective->shortcuts->web->把JS ...

  7. Linux 安装Oracle11g完整安装图文教程另附基本操作 (分享)

    一.修改操作系统核心参数 在Root用户下执行以下步骤: 1)修改用户的SHELL的限制,修改/etc/security/limits.conf文件 输入命令:vi /etc/security/lim ...

  8. RHEL7.X安装12.2RAC时root.sh错误CLSRSC-400的解决方案

    问题现象: [root@ora12c ghome]# /opt/oracle/ghome/root.sh Performing root user operation. The following e ...

  9. WebStrome react-native代码智能提示

    1.clone到本地 git clone https://github.com/virtoolswebplayer/ReactNative-LiveTemplate  2,添加ReactNative. ...

  10. CSU1216: 异或最大值(01Trie树)

    Description 给定一些数,求这些数中两个数的异或值最大的那个值 Input 多组数据.第一行为数字个数n,1 <= n <= 10 ^ 5.接下来n行每行一个32位有符号非负整数 ...