恢复误删除表黑科技之relay log大法(续)
//Check data at first.
zlm@192.168.56.100: [sysbench]>show tables;
+--------------------+
| Tables_in_sysbench |
+--------------------+
| sbtest1 |
| sbtest2 |
| sbtest3 |
| sbtest4 |
| sbtest5 |
+--------------------+
rows in set (0.00 sec) zlm@192.168.56.100: [sysbench]>select count(*) from sbtest5;
+----------+
| count(*) |
+----------+
| |
+----------+
row in set (0.00 sec) zlm@192.168.56.100: [sysbench]>show binary logs;
+------------------+-----------+
| Log_name | File_size |
+------------------+-----------+
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
+------------------+-----------+
rows in set (0.01 sec) zlm@192.168.56.100: [sysbench]>show master status;
+------------------+----------+--------------+------------------+-------------------------------------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------------------------------------+
| mysql-bin. | | | | 2a4b3562-2ab6-11e8-be7a-080027de0e0e:- |
+------------------+----------+--------------+------------------+-------------------------------------------------+
row in set (0.00 sec) //Generate a Xtrabackup then send it to the slave zlm2.
[root@zlm1 :: /data/backup]
#innobackupex --defaults-file=/data/mysql/mysql3306/my3306.cnf --user=root --password=Passw0rd /data/backup [root@zlm1 :: /data/backup]
#scp -r --31_16--/ zlm2:/data/backup/ //Continue to do some operations(DML).
zlm@192.168.56.100: [sysbench]>delete from sbtest5 limit ;
Query OK, rows affected (0.19 sec) zlm@192.168.56.100: [sysbench]>delete from sbtest5 limit ;
Query OK, rows affected (0.04 sec) //Drop the table.
zlm@192.168.56.100: [sysbench]>drop table sbtest5;
Query OK, rows affected (0.04 sec) zlm@192.168.56.100: [sysbench]>flush logs;
Query OK, rows affected (0.05 sec) zlm@192.168.56.100: [sysbench]>show master status;
+------------------+----------+--------------+------------------+-------------------------------------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------------------------------------+
| mysql-bin. | | | | 2a4b3562-2ab6-11e8-be7a-080027de0e0e:- |
+------------------+----------+--------------+------------------+-------------------------------------------------+
row in set (0.00 sec) //Shutdown the master.
zlm@192.168.56.100: [sysbench]>exit
Bye [root@zlm1 :: ~]
#mysqladmin shutdown //Send the binlogs which contain the operations above to slave zlm2 either.
[root@zlm1 :: ~]
#cd /data/mysql/mysql3306/logs [root@zlm1 :: /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.index [root@zlm1 :: /data/mysql/mysql3306/logs]
#scp mysql-bin.{,} zlm2:/data/backup
mysql-bin. % 933KB .6KB/s :
mysql-bin. % .2KB/s :
//Prepare to restore the backup of Xtrabackup.
[root@zlm2 :: /data/backup]
#innobackupex --defaults-file=/data/mysql/mysql3306/my3306.cnf -uroot -pPassw0rd --apply-log /data/backup/--31_16--/ [root@zlm2 :: /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
-rw-r----- mysql mysql Jul : master.info
drwxr-x--- mysql mysql Jul : mrbs
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.
-rw-r----- mysql mysql Jul : relay-bin.
-rw-r----- mysql mysql Jul : relay-bin.index
-rw-r----- mysql mysql Jul : relay-log.info
-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@zlm2 :: /data/mysql/mysql3306/data]
#ps aux|grep mysqld
root 0.0 0.0 pts/ R+ : : grep --color=auto mysqld [root@zlm2 :: /data/mysql/mysql3306/data]
#rm -rf * //Copy back the datafiles.
[root@zlm2 :: /data/backup]
#innobackupex --defaults-file=/data/mysql/mysql3306/my3306.cnf -uroot -pPassw0rd --copy-back /data/backup/--31_16--/ [root@zlm2 :: /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 : mrbs
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 [root@zlm2 :: /data/mysql/mysql3306/data]
#sh /root/mysqld.sh [root@zlm2 :: /data/mysql/mysql3306/data]
#mysql
ERROR (HY000): Can't connect to MySQL server on '192.168.56.101' (111) [root@zlm2 :: /data/mysql/mysql3306/data]
#chown -R mysql.mysql * [root@zlm2 :: /data/mysql/mysql3306/data]
#sh /root/mysqld.sh [root@zlm2 :: /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.56.101: [(none)]>select count(*) from sysbench.sbtest5;
+----------+
| count(*) |
+----------+
| |
+----------+
row in set (0.03 sec) //Continue to restore the incremental data with sql_thread.
[root@zlm2 :: /data/backup]
#ls -l
total
drwxr-x--- root root Jul : --31_16--
-rw-r----- root root Jul : mysql-bin.
-rw-r----- root root Jul : mysql-bin. [root@zlm2 :: /data/backup]
#for i in $(ls mysql-bin.*)
> do
> ext=$(echo $i | cut -d'.' -f2);
> cp $i relay-bin.$ext;
> done [root@zlm2 :: /data/backup]
#ls -l
total
drwxr-x--- root root Jul : --31_16--
-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@zlm2 :: /data/backup]
#ls ./relay-bin.* > relay-bin.index [root@zlm2 :: /data/backup]
#ls -l
total
drwxr-x--- root root Jul : --31_16--
-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@zlm2 :: /data/backup]
#cat relay-bin.index
./relay-bin.
./relay-bin. [root@zlm2 :: /data/backup]
#chown mysql.mysql relay* [root@zlm2 :: /data/backup]
#ls -l
total
drwxr-x--- root root Jul : --31_16--
-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 [root@zlm2 :: /data/backup]
#cp relay* /data/mysql/mysql3306/data [root@zlm2 :: /data/backup]
#cd /data/mysql/mysql3306/data [root@zlm2 :: /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
-rw-r----- mysql mysql Jul : ibtmp1
-rw-r----- mysql mysql Jul : innodb_status.
-rw-r----- mysql mysql Jul : innodb_status.
drwxr-x--- mysql mysql Jul : mrbs
drwxr-x--- mysql mysql Jul : mysql
-rw-r----- mysql mysql Jul : mysql.pid
drwxr-x--- mysql mysql Jul : performance_schema
-rw-r----- root root Jul : relay-bin.
-rw-r----- root root Jul : relay-bin.
-rw-r--r-- root root 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@zlm2 :: /data/mysql/mysql3306/data]
#chown mysql.mysql relay* [root@zlm2 :: /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
-rw-r----- mysql mysql Jul : ibtmp1
-rw-r----- mysql mysql Jul : innodb_status.
-rw-r----- mysql mysql Jul : innodb_status.
drwxr-x--- mysql mysql Jul : mrbs
drwxr-x--- mysql mysql Jul : mysql
-rw-r----- mysql mysql Jul : mysql.pid
drwxr-x--- mysql mysql Jul : performance_schema
-rw-r----- mysql mysql Jul : relay-bin.
-rw-r----- mysql mysql Jul : relay-bin.
-rw-r--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 zlm@192.168.56.101: [(none)]>show master status;
+------------------+----------+--------------+------------------+-------------------------------------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------------------------------------+
| mysql-bin. | | | | 2a4b3562-2ab6-11e8-be7a-080027de0e0e:- |
+------------------+----------+--------------+------------------+-------------------------------------------------+
row in set (0.00 sec) zlm@192.168.56.101: [(none)]>change master to relay_log_file='relay-bin.000103',relay_log_pos=,master_host='xxx';
Query OK, rows affected (0.01 sec) zlm@192.168.56.101: [(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: //No data here yet.
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: /data/mysql/mysql3306/data/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 data here.
Executed_Gtid_Set: 2a4b3562-2ab6-11e8-be7a-080027de0e0e:-
Auto_Position:
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
row in set (0.00 sec) [root@zlm2 :: /data/backup]
#ls -l
total
drwxr-x--- root root Jul : --31_16--
-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 //Find out the end position to set util clause.
[root@zlm2 :: /data/backup]
#mysqlbinlog --base64-output=decode-rows relay-bin. > .log [root@zlm2 :: /data/backup]
#tail - .log
# :: server id end_log_pos CRC32 0xe3e63622 Delete_rows: table id flags: STMT_END_F
# at
# :: server id end_log_pos CRC32 0x84cf5136 Xid =
COMMIT/*!*/;
# at //This position is which I need to set until to.
# :: server id end_log_pos CRC32 0xef03ef84 GTID last_committed= sequence_number= rbr_only=no
SET @@SESSION.GTID_NEXT= '2a4b3562-2ab6-11e8-be7a-080027de0e0e:12715699'/*!*/;
# at
# :: server id end_log_pos CRC32 0x0309b10f Query thread_id= exec_time= error_code=
use `sysbench`/*!*/;
SET TIMESTAMP=/*!*/;
DROP TABLE `sbtest5` /* generated by server */
/*!*/;
# at
# :: server id end_log_pos CRC32 0xc1ca182a 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*/; zlm@192.168.56.101: [(none)]>start slave sql_thread until relay_log_file='relay-bin.000103',relay_log_pos=;
Query OK, rows affected (0.00 sec) zlm@192.168.56.101: [(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: //This is the terminal relay log position I set just now.
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: /data/mysql/mysql3306/data/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: 2a4b3562-2ab6-11e8-be7a-080027de0e0e:-
Auto_Position:
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
row in set (0.00 sec) zlm@192.168.56.101: [(none)]>select count(*) from sysbench.sbtest5;
+----------+
| count(*) |
+----------+
| |
+----------+
row in set (0.00 sec)
3. The supplemented experiment.
//Shudown the instance.
[root@zlm2 :: /data/mysql/mysql3306/data]
#ps aux|grep mysqld
mysql 0.0 20.0 pts/ Sl : : mysqld --defaults-file=/data/mysql/mysql3306/my3306.cnf
root 0.0 0.0 pts/ R+ : : grep --color=auto mysqld [root@zlm2 :: /data/mysql/mysql3306/data]
#mysqladmin shutdown [root@zlm2 :: /data/mysql/mysql3306/data] //Copy back the data one more time(no need to executed with option "--apply-log" first this time).
[root@zlm2 :: /data/backup]
#innobackupex --defaults-file=/data/mysql/mysql3306/my3306.cnf -uroot -pPassw0rd --copy-back /data/backup/--31_16--/ //Copy the relay logs to datadir directory again.
[root@zlm2 :: /data/backup]
#ls -l
total
-rw-r--r-- root root Jul : .log
drwxr-x--- root root Jul : --31_16--
-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 [root@zlm2 :: /data/backup]
#cp relay* /data/mysql/mysql3306/data [root@zlm2 :: /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 : mrbs
drwxr-x--- root root Jul : mysql
drwxr-x--- root root Jul : performance_schema
-rw-r----- root root Jul : relay-bin.
-rw-r----- root root Jul : relay-bin.
-rw-r--r-- root root Jul : relay-bin.index
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 [root@zlm2 :: /data/mysql/mysql3306/data]
#chown -R mysql.mysql * [root@zlm2 :: /data/mysql/mysql3306/data]
#sh /root/mysqld.sh [root@zlm2 :: /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.56.101: [(none)]>select count(*) from sysbench.sbtest5;
+----------+
| count(*) |
+----------+
| |
+----------+
row in set (0.04 sec) zlm@192.168.56.101: [(none)]>show master status;
+------------------+----------+--------------+------------------+-------------------------------------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------------------------------------+
| mysql-bin. | | | | 2a4b3562-2ab6-11e8-be7a-080027de0e0e:- |
+------------------+----------+--------------+------------------+-------------------------------------------------+
row in set (0.00 sec) zlm@192.168.56.101: [(none)]>reset master;
Query OK, rows affected (0.03 sec) zlm@192.168.56.101: [(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.56.101: [(none)]>show slave status\G
Empty set (0.00 sec) zlm@192.168.56.101: [(none)]>set @@global.gtid_purged='2a4b3562-2ab6-11e8-be7a-080027de0e0e:1-12715696';
Query OK, rows affected (0.00 sec) zlm@192.168.56.101: [(none)]>show master status;
+------------------+----------+--------------+------------------+-------------------------------------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------------------------------------+
| mysql-bin. | | | | 2a4b3562-2ab6-11e8-be7a-080027de0e0e:- |
+------------------+----------+--------------+------------------+-------------------------------------------------+
row in set (0.00 sec) zlm@192.168.56.101: [(none)]>change master to relay_log_file='relay-bin.000103',relay_log_pos=,master_host='xxx';
Query OK, rows affected (0.01 sec) zlm@192.168.56.101: [(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: /data/mysql/mysql3306/data/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: 2a4b3562-2ab6-11e8-be7a-080027de0e0e:-
Auto_Position:
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
row in set (0.00 sec) zlm@192.168.56.101: [(none)]>start slave sql_thread until sql_before_gtids='2a4b3562-2ab6-11e8-be7a-080027de0e0e:12715699';
Query OK, rows affected (0.51 sec) zlm@192.168.56.101: [(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: SQL_BEFORE_GTIDS //This time we use this option to start slave sql_thread.
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: /data/mysql/mysql3306/data/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: 2a4b3562-2ab6-11e8-be7a-080027de0e0e:-
Auto_Position:
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
row in set (0.00 sec) zlm@192.168.56.101: [(none)]>select count(*) from sysbench.sbtest5;
+----------+
| count(*) |
+----------+
| |
+----------+
row in set (0.00 sec)
恢复误删除表黑科技之relay log大法(续)的更多相关文章
- 恢复误删除表黑科技之relay log大法
Preface In my previous blogs,I've demonstrated several mothods of how to rescue a dropped ta ...
- Oracle恢复误删除表操作语句
一.表和数据恢复 1.从回收站里查询被删除的表 select object_name,original_name,partition_name,type,ts_name,createtime,drop ...
- windows黑科技-记录dns log
昨天看到袁哥微博,看到了这篇,今天测试了一下,记录下来: The DNS Client service does not log by default. However, if a file name ...
- Oracle误删除表空间的恢复
对于误删除表空间的恢复,本文通过基于数据库的时间点恢复和基于表空间的时间点恢复分别加以讨论 一 通过基于数据库的时间点恢复被误删除的表空间 1 需要注意的事项 a 基于数据库的时间点恢复将会回退整个数 ...
- rman恢复误删除的一张表(不完全恢复)
恢复误删除的一张表可以使用很多方法,如日志挖掘.闪回等,rman恢复(不完全恢复)肯定不是最好的,也不建议用, 现在我们只是演示一下这种恢复. 1 RMAN备份数据库 2创建测试表 3查看此时的SCN ...
- ORACLE恢复误删除的对象(表、存储过程等)
1.恢复存储过程 原理就是利用了oracle里所有的存储过程的源代码都是存在dba_source里,而drop某个存储过程的时候,oracle这里肯定要去dba_source里把相关的源代码给dele ...
- Oracle误删除表数据后的恢复具体解释
Oracle误删除表数据后的恢复具体解释 測试环境: SYSTEM:IBM AIX 5L Oracle Version:10gR2 1. undo_re ...
- 利用flashBack恢复误删除(delete)的表数据
Flashback query(闪回查询)原理 Oracle根据undo信息,利用undo数据,类似一致性读取方法,可以把表置于一个删除前的时间点(或SCN),从而将数据找回. Flashback q ...
- mysql relay log参数汇总
前言:MySQL进行主主复制或主从复制的时候会在配置文件制定的目录下面产生相应的relay log,本文档总结这些相关参数的定义及解释. 1.什么是relay log The relay log, l ...
随机推荐
- 解决SD卡频繁读写问题 Anything-sync-daemon 映射linux目录到tmpfs并定时同步
Anything-sync-daemon (asd) is a is a diminutive pseudo-daemon designed to manage target directories ...
- LA 3708 墓地雕塑
题目链接:https://vjudge.net/contest/132704#problem/D 题意:一个长度为10000的园上,均匀分布n个雕塑,现在要加入m个雕塑,这样原先的就可能会移动,求移动 ...
- 【转】Android xml资源文件中@、@android:type、@*、?、@+含义和区别
一.@代表引用资源 1.引用自定义资源.格式:@[package:]type/name android:text="@string/hello" 2.引用系统资源.格式:@andr ...
- Entity Framework 连接 mysql 。(code first模式)
准备工作 1.下载vs2015 2.下载mysql2017 3.安装 1.创建类库 . 2.打开Nuget包,下载最新版的entity framewor. 3.在引用中添加 mysql.data; m ...
- Gtk-Message: Failed to load module “canberra-gtk-module”
编写wxPython程序时,总是报以下错误: Gtk-Message: Failed to load module “canberra-gtk-module” 解决办法:apt-get install ...
- P3391 【模板】文艺平衡树(Splay)
Splay #include<cstdio> #include<algorithm> #include<iostream> using namespace std; ...
- js 实现链表
我们通常会在c++这类语言中学习到链表的概念,但是在js中由于我们可以动态的扩充数组,加之有丰富的原生api.我们通常并不需要实现链表结构.由于突发奇想,我打算用js实现一下: 首先我们要创建链表: ...
- ckplayer插件播放视频
官网:超酷网页视频 本篇介绍:插件播放视频, 添加插件(额外的功能), 视频格式之间的转换 PC端一般都是利用插件(Flash)来播放视频,可以支持很多格式.网上很多说这个插件的,这里只是做个记录 ...
- 深入理解JVM类加载机制
1.什么是类加载机制? JVM把class文件加载到内存里面,并对数据进行验证.准备.解析和初始化,最终能够被形成被JVM可以直接使用的Java类型的过程. 生命周期包含:加载,验证,准备,解析,初始 ...
- javascript入门笔记2-window
1.JavaScript-输出内容(document.write) <script type="text/javascript"> document.write(&qu ...