您好,登錄后才能下訂單哦!
這篇文章主要講解了“怎么使用MySQL bingol”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“怎么使用MySQL bingol”吧!
1、binlog備份
[mysql@mysql5 binlog]$mysqlbinlog --read-from-remote-server --raw --host=192.168.1.210 --port=65535 --user=yang --password=oracle --stop-never --result-file=/mysqldb/backup/backup_192.168.1.210/binlog/ master-bin.000001
2、解析binlog
[mysql@mysql5 binlog]$ mysqlbinlog -v -v -v master-bin.000007 > 07.txt
[mysql@mysql5 binlog]$ vi 07.txt
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
#180807 11:18:46 server id 6666601 end_log_pos 123 CRC32 0x67606c44 Start: binlog v 4, server v 5.7.23-log created 180807 11:18:46
BINLOG '
lg9pWw9puWUAdwAAAHsAAAAAAAQANS43LjIzLWxvZwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAAXwAEGggAAAAICAgCAAAACgoKKioAEjQA
AURsYGc=
'/*!*/;
# at 123
#180807 11:18:46 server id 6666601 end_log_pos 194 CRC32 0xcc8d05b0 Previous-GTIDs
# 27b983f4-99ed-11e8-ab5d-000c29e42a1f:1-16
# at 194
#180807 11:37:34 server id 6666601 end_log_pos 259 CRC32 0x440038b5 GTID last_committed=0 sequence_number=1 rbr_only=no
SET @@SESSION.GTID_NEXT= '27b983f4-99ed-11e8-ab5d-000c29e42a1f:17'/*!*/;
............
3、binlog恢復(fù)
[mysql@mysql5 binlog]$ mysqlbinlog --start-position=161899 --stop-position=323048 --skip-gtids /mysqldb/db_slave/binlog/slave-bin.000001|mysql -uroot -p -S/mysqldb/db_test01/mysql.sock employees
實(shí)驗(yàn)
1、導(dǎo)入employees數(shù)據(jù)庫(kù)
2、創(chuàng)建表
mysql> create table test1 like dept_emp;
Query OK, 0 rows affected (0.85 sec)
mysql> alter table test1 drop primary key;
Query OK, 0 rows affected (0.31 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> insert into test1 select * from dept_emp limit 10000;
Query OK, 10000 rows affected (0.16 sec)
Records: 10000 Duplicates: 0 Warnings: 0
3、mysqldump備份employees數(shù)據(jù)庫(kù)
[mysql@mysql5 db_slave]$ mysqldump -uroot -p -S/mysqldb/db_slave/mysql.sock --master-data=2 --single-transaction --databases employees --set-gtid-purged=off > testdump.sql
Enter password:
4、模擬業(yè)務(wù)
mysql> insert into test1 select * from dept_emp limit 10000;
Query OK, 10000 rows affected (0.50 sec)
Records: 10000 Duplicates: 0 Warnings: 0
mysql> delete from test1 limit 1000;
Query OK, 1000 rows affected (0.30 sec)
mysql> create table test2 like dept_emp;
Query OK, 0 rows affected (0.27 sec)
5、發(fā)現(xiàn)問題進(jìn)行回滾
MASTER_LOG_POS=161899
at 323048
[mysql@mysql5 binlog]$ mysqlbinlog -v -v -v slave-bin.000001 > 1.txt
[mysql@mysql5 binlog]$ vi 1.txt
[mysql@mysql5 db_slave]$ vi testdump.sql
mysql> source /mysqldb/db_slave/testdump.sql #空實(shí)例中#
[mysql@mysql5 binlog]$ mysqlbinlog --start-position=161899 --stop-position=323048 --skip-gtids /mysqldb/db_slave/binlog/slave-bin.000001|mysql -uroot -p -S/mysqldb/db_test01/mysql.sock employees
5、結(jié)果
6、導(dǎo)入刪除數(shù)據(jù)
[mysql@mysql5 ~]$ mysqldump -uroot -p -S /mysqldb/db_test01/mysql.sock employees test1 --where="1=1 limit 1000;" --set-gtid-purged=OFF > test3.sql
Enter password:
[mysql@mysql5 ~]$ vi test3.sql
[mysql@mysql5 ~]$ mysql -uroot -p -S /mysqldb/db_slave/mysql.sock --database=employees --table=test1 < test3.sql
mysql: [Warning] mysql: ignoring option '--table' due to invalid value 'test1'
Enter password
感謝各位的閱讀,以上就是“怎么使用MySQL bingol”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對(duì)怎么使用MySQL bingol這一問題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是億速云,小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。