mysql資料恢復 insert\update\delete 工具MyFlash
一、簡介
MyFlash是由美團點評公司技術工程部開發維護的一個回滾DML操作的工具。該工具通過解析v4版本的binlog,完成回滾操作。相對已有的回滾工具,其增加了更多的過濾選項,讓回滾更加容易。 該工具已經在美團點評內部使用
程式碼地址:https://github.com/Meituan-Dianping/MyFlash
二、詳細說明
安裝
使用
測試用例
三、限制
binlog格式必須為row,且binlog_row_image=full
僅支援5.6與5.7
只能回滾DML(增、刪、改)
四、FAQ
實現的原理是什麼?
答:參考文章http://url.cn/5yVTfLY
支援gtid嗎?
答:支援。請參考 使用
在開啟gtid的MySQL server上,應用flashback報錯,錯誤為:ERROR 1782 (HY000) at line 16: @@SESSION.GTID_NEXT cannot be set to ANONYMOUS when @@GLOBAL.GTID_MODE = ON. ?
答:在匯入時加入--skip-gtids mysqlbinlog --skip-gtids | mysql -uxxx -pxxx
如果回滾後的binlog日誌尺寸超過20M,在匯入時,很耗時。如何處理?
答:參考 使用 ,搜尋maxSplitSize。使用該引數可以對檔案進行切片
五、聯絡方式
QQ群:645702809
安裝
1.How to build
該工具推薦使用者在下載原始碼之後,進行動態編譯連結安裝
動態編譯連結
gcc -w `pkg-config --cflags --libs glib-2.0` source/binlogParseGlib.c -o binary/flashback
然而使用者不想每次去重新編譯,可以選擇使用靜態連結,但是該方法需要知道glib庫的版本和位置,因此對於每臺機器略有不同,請謹慎使用
靜態編譯連結
為了保證在一臺機器上編譯後,可以在其它機器上使用,需要滿足以下兩個條件 a) 將glib做成靜態連結 b)在編譯的那臺機器的glibc版本
(檢視方法為ldd --version)要小於等於要執行該軟體的那臺機器glibc版本 因此需要你在一臺glibc版本較低的機器上執行如下命令即可。
gcc -w -g `pkg-config --cflags glib-2.0` source/binlogParseGlib.c -o binary/flashback /usr/lib64/libglib-2.0.a -lrt
使用
1.How to use
cd binary
./flashback --help
Usage:
flashback [OPTION...]
Help Options:
-?, --help Show help options
Application Options:
--databaseNames databaseName to apply. if multiple, seperate by comma(,)
--tableNames tableName to apply. if multiple, seperate by comma(,)
--start-position start position
--stop-position stop position
--start-datetime start time (format %Y-%m-%d %H:%M:%S)
--stop-datetime stop time (format %Y-%m-%d %H:%M:%S)
--sqlTypes sql type to filter . support INSERT, UPDATE ,DELETE. if multiple, seperate by comma(,)
--maxSplitSize max file size after split, the uint is M
--binlogFileNames binlog files to process. if multiple, seperate by comma(,)
--outBinlogFileNameBase output binlog file name base
--logLevel log level, available option is debug,warning,error
--include-gtids gtids to process
--exclude-gtids gtids to skip
2.Parameter explantion
下面的這些引數是可以任意組合的。
1.databaseNames 指定需要回滾的資料庫名。多個數據庫可以用“,”隔開。如果不指定該引數,相當於指定了所有資料庫。
2.tableNames 指定需要回滾的表名。多個表可以用“,”隔開。如果不指定該引數,相當於指定了所有表。
3.start-position 指定回滾開始的位置。如不指定,從檔案的開始處回滾。請指定正確的有效的位置,否則無法回滾
4.stop-position 指定回滾結束的位置。如不指定,回滾到檔案結尾。請指定正確的有效的位置,否則無法回滾
5.start-datetime 指定回滾的開始時間。注意格式必須是 %Y-%m-%d %H:%M:%S。 如不指定,則不限定時間
6.stop-datetime 指定回滾的結束時間。注意格式必須是 %Y-%m-%d %H:%M:%S。 如不指定,則不限定時間
7.sqlTypes 指定需要回滾的sql型別。目前支援的過濾型別是INSERT, UPDATE ,DELETE。多個型別可以用“,”隔開。
8.maxSplitSize 一旦指定該引數,對檔案進行固定尺寸的分割(單位為M),過濾條件有效,但不進行回滾操作。該引數主要用來將大的binlog檔案切割,防止單次應用的binlog尺寸過大,對線上造成壓力
9.binlogFileNames 指定需要回滾的binlog檔案,目前只支援單個檔案,後續會增加多個檔案支援
10.outBinlogFileNameBase 指定輸出的binlog檔案字首,如不指定,則預設為binlog_output_base.flashback
11.logLevel 僅供開發者使用,預設級別為error級別。在生產環境中不要修改這個級別,否則輸出過多
12.include-gtids 指定需要回滾的gtid,支援gtid的單個和範圍兩種形式。
13.exclude-gtids 指定不需要回滾的gtid,用法同include-gtids
3.example
1.回滾整個檔案
./flashback --binlogFileNames=haha.000041
mysqlbinlog binlog_output_base.flashback | mysql -h<host> -u<user> -p
2.回滾該檔案中的所有insert語句
./flashback --sqlTypes='INSERT' --binlogFileNames=haha.000041
mysqlbinlog binlog_output_base.flashback | mysql -h<host> -u<user> -p
3.回滾大檔案
回滾
./flashback --binlogFileNames=haha.000042
切割大檔案
./flashback --maxSplitSize=1 --binlogFileNames=binlog_output_base.flashback
應用
mysqlbinlog binlog_output_base.flashback.000001 | mysql -h<host> -u<user> -p
...
mysqlbinlog binlog_output_base.flashback.<N> | mysql -h<host> -u<user> -p
測試用例
###測試表結構
CREATE TABLE `testFlashback2` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nameShort` varchar(20) DEFAULT NULL,
`nameLong` varchar(260) DEFAULT NULL,
`amount` decimal(19,9) DEFAULT NULL,
`amountFloat` float DEFAULT NULL,
`amountDouble` double DEFAULT NULL,
`createDatetime6` datetime(6) DEFAULT NULL,
`createDatetime` datetime DEFAULT NULL,
`createTimestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`nameText` text,
`nameBlob` blob,
`nameMedium` mediumtext,
PRIMARY KEY (`id`)
) ENGINE=InnoDB
####插入回滾
flush logs
insert into testFlashback2(nameShort,nameLong,amount,amountFloat,amountDouble,createDatetime6,createDatetime,createTimestamp,nameText,nameBlob,nameMedium)
values('aaa','bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',10.5,10.6,10.7,'2017-10-26 10:00:00','2017-10-26 10:00:00','2017-10-26 10:00:00','cccc','dddd','eee');
insert into testFlashback2(nameShort,nameLong,amount,amountFloat,amountDouble,createDatetime6,createDatetime,createTimestamp,nameText,nameBlob,nameMedium)
values('aaa','bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',10.5,10.6,10.7,'2017-10-26 10:00:00','2017-10-26 10:00:00','2017-10-26 10:00:00','cccc','dddd','eee');
flush logs;
./binary/flashback --binlogFileNames=/var/lib/mysql/haha.000048
在當前執行目錄下產生binlog_output_base.flashback檔案
mysqlbinlog --skip-gtids binlog_output_base.flashback | mysql --socket=/var/lib/mysql/mysql.sock test
執行結果
mysql> select * from testFlashback2;
Empty set (0.00 sec)
插入回滾成功
####刪除回滾
delete from testFlashback2;
insert into testFlashback2(nameShort,nameLong,amount,amountFloat,amountDouble,createDatetime6,createDatetime,createTimestamp,nameText,nameBlob,nameMedium)
values('aaa','bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',10.5,10.6,10.7,'2017-10-26 10:00:00','2017-10-26 10:00:00','2017-10-26 10:00:00','cccc','dddd','eee');
flush logs;
delete from testFlashback2;
./binary/flashback --binlogFileNames=/var/lib/mysql/haha.000050
在當前執行目錄下產生binlog_output_base.flashback檔案
mysqlbinlog --skip-gtids binlog_output_base.flashback | mysql --socket=/var/lib/mysql/mysql.sock test
執行結果
+----+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------+-------------+--------------+----------------------------+---------------------+---------------------+----------+----------+------------+
| id | nameShort | nameLong | amount | amountFloat | amountDouble | createDatetime6 | createDatetime | createTimestamp | nameText | nameBlob | nameMedium |
+----+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------+-------------+--------------+----------------------------+---------------------+---------------------+----------+----------+------------+
| 4 | aaa | bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb | 10.500000000 | 10.6 | 10.7 | 2017-10-26 10:00:00.000000 | 2017-10-26 10:00:00 | 2017-10-26 10:00:00 | cccc | dddd | eee |
+----+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------+-------------+--------------+----------------------------+---------------------+---------------------+----------+----------+------------+
####更新回滾
delete from testFlashback2;
insert into testFlashback2(nameShort,nameLong,amount,amountFloat,amountDouble,createDatetime6,createDatetime,createTimestamp,nameText,nameBlob,nameMedium)
values('aaa','bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',10.111,10.6,10.7,'2017-10-26 10:00:00','2017-10-26 10:00:00','2017-10-26 10:00:00','cccc','dddd','eee');
flush logs;
mysql> checksum table testFlashback2;
+---------------------+-----------+
| Table | Checksum |
+---------------------+-----------+
| test.testFlashback2 | 717087411 |
+---------------------+-----------+
update testFlashback2 set amount=10.222;
mysql> checksum table testFlashback2;
+---------------------+------------+
| Table | Checksum |
+---------------------+------------+
| test.testFlashback2 | 3797190846 |
+---------------------+------------+
./binary/flashback --binlogFileNames=/var/lib/mysql/haha.000052
mysqlbinlog --skip-gtids binlog_output_base.flashback | mysql --socket=/var/lib/mysql/mysql.sock test
mysql> checksum table testFlashback2;
+---------------------+-----------+
| Table | Checksum |
+---------------------+-----------+
| test.testFlashback2 | 717087411 |
+---------------------+-----------+
####更新回滾(beta環境業務表,總資料量100w,回滾1k資料)
CREATE TABLE `DP_FeedBackForPOI_For_Flashback` (
`FeedID` int(11) NOT NULL AUTO_INCREMENT,
`UserName` varchar(50) DEFAULT NULL,
`UserEmail` varchar(100) DEFAULT NULL,
`UserPhone` varchar(20) DEFAULT NULL,
`UserID` int(11) DEFAULT '0',
`FeedTitle` varchar(200) DEFAULT NULL,
`FeedComments` text,
`FeedAdddate` datetime DEFAULT NULL,
`FeedStatus` tinyint(3) unsigned DEFAULT '0',
`SendTitle` varchar(200) DEFAULT NULL,
`SendComments` text,
`SendDate` datetime DEFAULT NULL,
`MailTO` varchar(100) DEFAULT NULL,
`FeedType` tinyint(3) unsigned DEFAULT '0',
`LastAdminID` smallint(6) DEFAULT NULL,
`ReferID` int(11) DEFAULT '0',
`ReferUserID` int(11) DEFAULT '0',
`ReferShopID` int(11) DEFAULT '0',
`FeedGroupID` int(11) DEFAULT '0',
`CauseType` tinyint(4) DEFAULT '0',
`ClientType` tinyint(4) DEFAULT '0',
`LastAdminName` varchar(50) DEFAULT NULL,
PRIMARY KEY (`FeedID`),
KEY `LastAdminID` (`LastAdminID`) USING BTREE,
KEY `FeedStatus` (`FeedStatus`,`FeedAdddate`,`FeedType`) USING BTREE,
KEY `MailTO` (`MailTO`,`FeedAdddate`,`FeedStatus`) USING BTREE,
KEY `FeedType` (`FeedType`,`FeedAdddate`,`UserEmail`) USING BTREE,
KEY `FeedGroupID` (`FeedGroupID`) USING BTREE,
KEY `FeedID_FeedStatus` (`FeedStatus`,`FeedGroupID`) USING BTREE,
KEY `UserName` (`UserName`,`MailTO`,`FeedType`,`FeedGroupID`) USING BTREE,
KEY `IX_UserID` (`UserID`) USING BTREE,
KEY `IX_ReferUserID` (`ReferUserID`) USING BTREE,
KEY `IX_ReferShopID` (`ReferShopID`) USING BTREE,
KEY `FeedType_2` (`FeedType`,`ReferID`)
) ENGINE=InnoDB AUTO_INCREMENT=2078564 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;
mysql> checksum table DP_FeedBackForPOI_For_Flashback;
+---------------------------------+-----------+
| Table | Checksum |
+---------------------------------+-----------+
| DP_FeedBackForPOI_For_Flashback | 717087411 |
+---------------------------------+-----------+
update DP_FeedBackForPOI_For_Flashback set UserName='wangguangyou' limit 1000;
mysql> checksum table DP_FeedBackForPOI_For_Flashback;
+---------------------------------+-----------+
| Table | Checksum |
+---------------------------------+-----------+
| DP_FeedBackForPOI_For_Flashback | 3532811761|
+---------------------------------+-----------+
./binary/flashback --binlogFileNames=/var/lib/mysql/haha.000058
mysqlbinlog --skip-gtids binlog_output_base.flashback | mysql --socket=/var/lib/mysql/mysql.sock test
mysql> checksum table DP_FeedBackForPOI_For_Flashback;
+---------------------------------+-----------+
| Table | Checksum |
+---------------------------------+-----------+
| DP_FeedBackForPOI_For_Flashback | 717087411 |
+---------------------------------+-----------+
==
yum install git -y git clone https://github.com/Meituan-Dianping/MyFlash.git cd MyFlash/ yum install glib2 -y gcc -w `pkg-config --cflags --libs glib-2.0` source/binlogParseGlib.c -o binary/flashback cd binary ./flashback --help
[[email protected] binary]# ./flashback --help
Usage:
flashback [OPTION?]
Help Options:
-h, --help Show help options
Application Options:
--databaseNames databaseName to apply. if multiple, seperate by comma(,)
--tableNames tableName to apply. if multiple, seperate by comma(,)
--start-position start position
--stop-position stop position
--start-datetime start time (format %Y-%m-%d %H:%M:%S)
--stop-datetime stop time (format %Y-%m-%d %H:%M:%S)
--sqlTypes sql type to filter . support INSERT, UPDATE ,DELETE. if multiple, seperate by comma(,)
--maxSplitSize max file size after split, the uint is M
--binlogFileNames binlog files to process. if multiple, seperate by comma(,)
--outBinlogFileNameBase output binlog file name base
--logLevel log level, available option is debug,warning,error
--include-gtids gtids to process
--exclude-gtids gtids to skip
([email protected]:3306) [test]> flush logs;
([email protected]:3306) [test]> show binary logs;
| mysql-bin.000009 | 120 |
###測試表結構
CREATE TABLE `testFlashback2` ( `id` int(11) NOT NULL AUTO_INCREMENT, `nameShort` varchar(20) DEFAULT NULL, `nameLong` varchar(260) DEFAULT NULL, `amount` decimal(19,9) DEFAULT NULL, `amountFloat` float DEFAULT NULL, `amountDouble` double DEFAULT NULL, `createDatetime6` datetime(6) DEFAULT NULL, `createDatetime` datetime DEFAULT NULL, `createTimestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `nameText` text, `nameBlob` blob, `nameMedium` mediumtext, PRIMARY KEY (`id`) ) ENGINE=InnoDB
####插入回滾
insert into testFlashback2(nameShort,nameLong,amount,amountFloat,amountDouble,createDatetime6,createDatetime,createTimestamp,nameText,nameBlob,nameMedium) values('aaa','bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',10.5,10.6,10.7,'2017-10-26 10:00:00','2017-10-26 10:00:00','2017-10-26 10:00:00','cccc','dddd','eee'); insert into testFlashback2(nameShort,nameLong,amount,amountFloat,amountDouble,createDatetime6,createDatetime,createTimestamp,nameText,nameBlob,nameMedium) values('aaa','bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',10.5,10.6,10.7,'2017-10-26 10:00:00','2017-10-26 10:00:00','2017-10-26 10:00:00','cccc','dddd','eee');
([email protected]:3306) [test]> show binary logs;
| mysql-bin.000009 | 1748 |
====
##這裡正好是一個新binlog檔案,並且只有這一個操作,但實際情況並不適用,實際你先找到binlog,轉換成sql檔案,確認操作的sql和位置點
mysqlbinlog mysql-bin.000097 --base64-output=decode-rows -vv >bin97.sql
cat bin97.sql |grep testFlashback2
###然後在後面加 --start-position等,能選擇具體回覆的資料專案
./flashback --start-position=6088478 --stop-position=6088641
====
[[email protected] binary]# ./flashback --binlogFileNames=/home/data/mysqldata/3306/binlog/mysql-bin.000009
[[email protected] binary]# ll
total 7344
-rw-r--r-- 1 root root 904 Dec 26 11:27 binlog_output_base.flashback
-rwxr-xr-x 1 root root 80046 Dec 26 11:15 flashback
-rwxr-xr-x 1 root root 7463125 Dec 26 11:15 mysqlbinlog20160408
[[email protected] binary]# chown mysql.mysql binlog_output_base.flashback
[[email protected] ~]# su - mysql
Last login: Tue Dec 25 10:55:11 CST 2018 on pts/0
[[email protected] ~]$ cd /data/soft/MyFlash/binary/
[[email protected] binary]$ ll
total 7344
-rw-r--r-- 1 mysql mysql 904 Dec 26 11:27 binlog_output_base.flashback
-rwxr-xr-x 1 root root 80046 Dec 26 11:15 flashback
-rwxr-xr-x 1 root root 7463125 Dec 26 11:15 mysqlbinlog20160408
[[email protected] binary]$ mysqlbinlog binlog_output_base.flashback | mysql -usystem -p -h127.0.0.1 -P3306 test
Enter password:
([email protected]:3306) [test]> select * from testFlashback2;
####刪除回滾
delete from testFlashback2; insert into testFlashback2(nameShort,nameLong,amount,amountFloat,amountDouble,createDatetime6,createDatetime,createTimestamp,nameText,nameBlob,nameMedium) values('aaa','bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',10.5,10.6,10.7,'2017-10-26 10:00:00','2017-10-26 10:00:00','2017-10-26 10:00:00','cccc','dddd','eee'); flush logs; delete from testFlashback2;
([email protected]:3306) [test]> show binary logs;
| mysql-bin.000010 | 615 |
[[email protected] binary]# ./flashback --binlogFileNames=/home/data/mysqldata/3306/binlog/mysql-bin.000010
[[email protected] binary]# chown mysql.mysql binlog_output_base.flashback
[[email protected] binary]$ mysqlbinlog binlog_output_base.flashback | mysql -usystem -p -h127.0.0.1 -P3306 test
([email protected]:3306) [test]> select *from testFlashback2;
####更新回滾
delete from testFlashback2;
insert into testFlashback2(nameShort,nameLong,amount,amountFloat,amountDouble,createDatetime6,createDatetime,createTimestamp,nameText,nameBlob,nameMedium)
values('aaa','bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb',10.111,10.6,10.7,'2017-10-26 10:00:00','2017-10-26 10:00:00','2017-10-26 10:00:00','cccc','dddd','eee');
flush logs;
([email protected]:3306) [test]> checksum table testFlashback2;
+---------------------+------------+
| Table | Checksum |
+---------------------+------------+
| test.testFlashback2 | 2649253452 |
+---------------------+------------+
1 row in set (0.00 sec)
([email protected]:3306) [test]> update testFlashback2 set amount=10.222;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
([email protected]:3306) [test]> checksum table testFlashback2;
+---------------------+------------+
| Table | Checksum |
+---------------------+------------+
| test.testFlashback2 | 3574042806 |
+---------------------+------------+
([email protected]:3306) [test]> show binary logs;
| mysql-bin.000010 | 2155 |
| mysql-bin.000011 | 890 |
[[email protected] binary]# ./flashback --binlogFileNames=/home/data/mysqldata/3306/binlog/mysql-bin.000011
[[email protected] binary]# chown mysql.mysql binlog_output_base.flashback
[[email protected] binary]$ mysqlbinlog binlog_output_base.flashback | mysql -usystem -p -h127.0.0.1 -P3306 test
Enter password:
([email protected]:3306) [test]> checksum table testFlashback2;
+---------------------+------------+
| Table | Checksum |
+---------------------+------------+
| test.testFlashback2 | 2649253452 |
+---------------------+------------+