MySQL binlog 企业案例升级版
需求:
1、创建一个数据库 oldboy
2、在oldboy下创建一张表t1
3、插入5行任意数据
4、全备
5、插入两行数据,任意修改3行数据,删除1行数据
6、删除所有数据
7、再t1中又插入5行新数据,修改3行数据
需求,跳过第六步恢复表数据
分析问题解决问题
1 如果没有误操作 数据会是什么样 先模拟
- #-------------------------------------------------------------------------------
- #
- # day8 练习
- # Author:nod
- # Date:18-08-05
- #-------------------------------------------------------------------------------
- #-------------------------------------------------------------------------------
- #
- # 本次练习题当中6为误操作,因而处理方式就是跳过第六步看看正常数据如何
- # 再按步骤1-7在主库上进行操作 恢复数据等进行测试
- #-------------------------------------------------------------------------------
- 需求:
- 1、创建一个数据库 oldboy
- 2、在oldboy下创建一张表t1
- 3、插入5行任意数据
- 4、全备
- 5、插入两行数据,任意修改3行数据,删除1行数据
- 6、删除所有数据
- 7、再t1中又插入5行新数据,修改3行数据
- 需求,跳过第六步恢复表数据
- mysql> create database oldboy;
- mysql> use oldboy;
- mysql> create table t1(id int);
- mysql> insert into t1 values(1),(2),(3),(4),(5);
- mysql> select * from t1;
- +------+
- | id |
- +------+
- | 1 |
- | 2 |
- | 3 |
- | 4 |
- | 5 |
- +------+
- # 插入两行数据,任意修改3行数据,删除1行数据
- mysql> insert into t1 values(6),(7);
- mysql> update t1 set id=11 where id=1;
- mysql> update t1 set id=22 where id=2;
- mysql> update t1 set id=33 where id=3;
- mysql> delete from t1 where id=7;
- # 再t1中又插入5行新数据,修改3行数据
- mysql> insert into t1 values(8),(9),(10),(11),(12);
- mysql> update t1 set id=100 where id=10;
- mysql> update t1 set id=110 where id=11;
- mysql> update t1 set id=120 where id=12;
- # 正确效果数据
- mysql> select * from t1;
- +------+
- | id |
- +------+
- | 110 |
- | 22 |
- | 33 |
- | 4 |
- | 5 |
- | 6 |
- | 8 |
- | 9 |
- | 100 |
- | 110 |
- | 120 |
- +------+
分析后得出对应的解决方法
全备恢复 +第5步骤+第七步骤 跳过第六步骤 需要对mysqlbinlog进行分析
- #-------------------------------------------------------------------------------
- #
- # day8 练习实际步骤
- # Author:nod
- # Date:18-08-05
- #-------------------------------------------------------------------------------
- 需求:
- 1、创建一个数据库 oldboy
- 2、在oldboy下创建一张表t1
- 3、插入5行任意数据
- 4、全备
- 5、插入两行数据,任意修改3行数据,删除1行数据
- 6、删除所有数据
- 7、再t1中又插入5行新数据,修改3行数据
- 需求,跳过第六步恢复表数据
- #-------------------------------------------------------------------------------
- # 1-3步骤
- #-------------------------------------------------------------------------------
- mysql> flush logs;
- mysql> create database oldboy;
- mysql> use oldboy;
- Database changed
- mysql> create table t1(id int);
- mysql> insert into t1 values(1),(2),(3),(4),(5);
- #-------------------------------------------------------------------------------
- # 全备
- #-------------------------------------------------------------------------------
- mysqldump -uroot -p123 -A -R --triggers --master-data=2 --single-transaction > /backup/full3.sql
- #-------------------------------------------------------------------------------
- # 5 插入两行数据,任意修改3行数据,删除1行数据
- #-------------------------------------------------------------------------------
- mysql> insert into t1 values(6),(7);
- mysql> update t1 set id=11 where id=1;
- mysql> update t1 set id=22 where id=2;
- mysql> update t1 set id=33 where id=3;
- mysql> delete from t1 where id=7;
- #-------------------------------------------------------------------------------
- # 6 删除所有数据 1637
- #-------------------------------------------------------------------------------
- #
- mysql> delete from t1;
- #-------------------------------------------------------------------------------
- # 7 再t1中又插入5行新数据,修改3行数据
- #-------------------------------------------------------------------------------
- mysql> insert into t1 values(8),(9),(10),(11),(12); 1702 2586
- mysql> update t1 set id=100 where id=10;
- mysql> update t1 set id=110 where id=11;
- mysql> update t1 set id=120 where id=12;
- #-------------------------------------------------------------------------------
- # 脏数据
- #-------------------------------------------------------------------------------
- mysql> select * from t1;
- +------+
- | id |
- +------+
- | 8 |
- | 9 |
- | 100 |
- | 110 |
- | 120 |
- +------+
- 5 rows in set (0.00 sec)
- #-------------------------------------------------------------------------------
- # 数据处理部分
- #-------------------------------------------------------------------------------
- #
- #-------------------------------------------------------------------------------
- # 数据分析/backup/full3.sql
- #-------------------------------------------------------------------------------
- 22:CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000013', MASTER_LOG_POS=533;
- #-------------------------------------------------------------------------------
- # 数据分析mysql-bin.000013
- #-------------------------------------------------------------------------------
- mysqlbinlog --base64-output=decode-rows -vvv /data/mysql/mysql-bin.000013
- mysqlbinlog --start-position=533 --stop-position=1590 /data/mysql/mysql-bin.000013 >/backup/inc1.sql
- mysqlbinlog --start-position=1702 --stop-position=2586 /data/mysql/mysql-bin.000013 >/backup/inc2.sql
- #-------------------------------------------------------------------------------
- # 在备份库上进行主库全备恢复+步骤6 步骤7操作恢复
- #-------------------------------------------------------------------------------
- mysql> source /backup/full3.sql;
- mysql> source /backup/inc1.sql
- mysql> source /backup/inc2.sql
- #-------------------------------------------------------------------------------
- # ERROR 1666 (HY000): Cannot execute statement: impossible to write to binary log since statement is in row # # format and BINLOG_FORMAT = STATEMENT.
- # 解决方法:
- # 主库是row模式 因而备份库也要row模式 修改后解决
- #-------------------------------------------------------------------------------
- #-------------------------------------------------------------------------------
- # 验证数据 数据恢复正确
- #-------------------------------------------------------------------------------
- mysql> select * from t1;
- +------+
- | id |
- +------+
- | 110 |
- | 22 |
- | 33 |
- | 4 |
- | 5 |
- | 6 |
- | 8 |
- | 9 |
- | 100 |
- | 11 |
- | 120 |
- +------+
- 11 rows in set (0.00 sec)
- #-------------------------------------------------------------------------------
- # 将带有误操作(删除)的t1表导出
- #-------------------------------------------------------------------------------
- [root@db01 backup]# mysqldump -uroot -p123 -S /data/3307/mysql.sock oldboy t1 >/backup/t1.sql
- #-------------------------------------------------------------------------------
- # 主库进行恢复t1表操作
- #-------------------------------------------------------------------------------
- #-------------------------------------------------------------------------------
- # 查看oldboy下t1的数据,目前数据应该是有问题的数据
- #-------------------------------------------------------------------------------
- mysql> use oldboy;
- mysql> select * from t1;
- +------+
- | id |
- +------+
- | 8 |
- | 9 |
- | 100 |
- | 110 |
- | 120 |
- +------+
- 5 rows in set (0.00 sec)
- #-------------------------------------------------------------------------------
- # 开始恢复t1操作
- #-------------------------------------------------------------------------------
- mysql> source /backup/t1.sql;
- Query OK, 0 rows affected (0.00 sec)
- Query OK, 0 rows affected (0.00 sec)
- Query OK, 0 rows affected (0.00 sec)
- Query OK, 0 rows affected (0.00 sec)
- Query OK, 0 rows affected (0.00 sec)
- Query OK, 0 rows affected (0.00 sec)
- Query OK, 0 rows affected (0.00 sec)
- Query OK, 0 rows affected (0.00 sec)
- Query OK, 0 rows affected (0.00 sec)
- Query OK, 0 rows affected (0.00 sec)
- Query OK, 0 rows affected (0.02 sec)
- Query OK, 0 rows affected (0.00 sec)
- Query OK, 0 rows affected (0.00 sec)
- Query OK, 0 rows affected (0.07 sec)
- Query OK, 0 rows affected (0.00 sec)
- Query OK, 0 rows affected (0.01 sec)
- Query OK, 0 rows affected (0.00 sec)
- Query OK, 11 rows affected (0.01 sec)
- Records: 11 Duplicates: 0 Warnings: 0
- Query OK, 0 rows affected (0.00 sec)
- Query OK, 0 rows affected (0.00 sec)
- Query OK, 0 rows affected (0.00 sec)
- Query OK, 0 rows affected (0.00 sec)
- Query OK, 0 rows affected (0.00 sec)
- Query OK, 0 rows affected (0.00 sec)
- Query OK, 0 rows affected (0.00 sec)
- Query OK, 0 rows affected (0.00 sec)
- Query OK, 0 rows affected (0.00 sec)
- Query OK, 0 rows affected (0.00 sec)
- #-------------------------------------------------------------------------------
- # 恢复完毕 检查数据 恢复操作完成
- #-------------------------------------------------------------------------------
- mysql> select * from t1;
- +------+
- | id |
- +------+
- | 110 |
- | 22 |
- | 33 |
- | 4 |
- | 5 |
- | 6 |
- | 8 |
- | 9 |
- | 100 |
- | 11 |
- | 120 |
- +------+
- 11 rows in set (0.00 sec)
分析的binlogcode
要对比分析begin commit 要多加体会
- #-------------------------------------------------------------------------------
- #
- # day8练习题binlog文件
- #-------------------------------------------------------------------------------
- [root@db01 backup]# mysqlbinlog --base64-output=decode-rows -vvv /data/mysql/mysql-bin.000013
- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
- /*!40019 SET @@session.max_insert_delayed_threads=0*/;
- /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
- DELIMITER /*!*/;
- # at 4
- #180805 23:51:27 server id 6 end_log_pos 120 CRC32 0xd5be46c7 Start: binlog v 4, server v 5.6.38-log created 180805 23:51:27
- # at 120
- #180805 23:51:36 server id 6 end_log_pos 220 CRC32 0xeaa89679 Query thread_id=13 exec_time=0 error_code=0
- SET TIMESTAMP=1533484296/*!*/;
- SET @@session.pseudo_thread_id=13/*!*/;
- SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
- SET @@session.sql_mode=1075838976/*!*/;
- SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
- /*!\C utf8 *//*!*/;
- SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=33/*!*/;
- SET @@session.lc_time_names=0/*!*/;
- SET @@session.collation_database=DEFAULT/*!*/;
- create database oldboy
- /*!*/;
- # at 220
- #180805 23:52:19 server id 6 end_log_pos 321 CRC32 0x23a9496d Query thread_id=13 exec_time=0 error_code=0
- use `oldboy`/*!*/;
- SET TIMESTAMP=1533484339/*!*/;
- create table t1(id int)
- /*!*/;
- # at 321
- #180805 23:52:30 server id 6 end_log_pos 395 CRC32 0x73300da7 Query thread_id=13 exec_time=0 error_code=0
- SET TIMESTAMP=1533484350/*!*/;
- BEGIN
- /*!*/;
- # at 395
- #180805 23:52:30 server id 6 end_log_pos 442 CRC32 0xe87526c3 Table_map: `oldboy`.`t1` mapped to number 283
- # at 442
- #180805 23:52:30 server id 6 end_log_pos 502 CRC32 0x681dd9f1 Write_rows: table id 283 flags: STMT_END_F
- ### INSERT INTO `oldboy`.`t1`
- ### SET
- ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
- ### INSERT INTO `oldboy`.`t1`
- ### SET
- ### @1=2 /* INT meta=0 nullable=1 is_null=0 */
- ### INSERT INTO `oldboy`.`t1`
- ### SET
- ### @1=3 /* INT meta=0 nullable=1 is_null=0 */
- ### INSERT INTO `oldboy`.`t1`
- ### SET
- ### @1=4 /* INT meta=0 nullable=1 is_null=0 */
- ### INSERT INTO `oldboy`.`t1`
- ### SET
- ### @1=5 /* INT meta=0 nullable=1 is_null=0 */
- # at 502
- #180805 23:52:30 server id 6 end_log_pos 533 CRC32 0x0b8ae04d Xid = 9250
- COMMIT/*!*/;
- # at 533
- #180805 23:55:47 server id 6 end_log_pos 607 CRC32 0x9df4f1c1 Query thread_id=13 exec_time=0 error_code=0
- SET TIMESTAMP=1533484547/*!*/;
- BEGIN
- /*!*/;
- # at 607
- #180805 23:55:47 server id 6 end_log_pos 654 CRC32 0x5f289eed Table_map: `oldboy`.`t1` mapped to number 324
- # at 654
- #180805 23:55:47 server id 6 end_log_pos 699 CRC32 0x56cbcd59 Write_rows: table id 324 flags: STMT_END_F
- ### INSERT INTO `oldboy`.`t1`
- ### SET
- ### @1=6 /* INT meta=0 nullable=1 is_null=0 */
- ### INSERT INTO `oldboy`.`t1`
- ### SET
- ### @1=7 /* INT meta=0 nullable=1 is_null=0 */
- # at 699
- #180805 23:55:47 server id 6 end_log_pos 730 CRC32 0xd3310e29 Xid = 10117
- COMMIT/*!*/;
- # at 730
- #180805 23:55:52 server id 6 end_log_pos 804 CRC32 0x4fa560fa Query thread_id=13 exec_time=0 error_code=0
- SET TIMESTAMP=1533484552/*!*/;
- BEGIN
- /*!*/;
- # at 804
- #180805 23:55:52 server id 6 end_log_pos 851 CRC32 0x0c2cb62f Table_map: `oldboy`.`t1` mapped to number 324
- # at 851
- #180805 23:55:52 server id 6 end_log_pos 897 CRC32 0x7641ef30 Update_rows: table id 324 flags: STMT_END_F
- ### UPDATE `oldboy`.`t1`
- ### WHERE
- ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
- ### SET
- ### @1=11 /* INT meta=0 nullable=1 is_null=0 */
- # at 897
- #180805 23:55:52 server id 6 end_log_pos 928 CRC32 0xc96642d8 Xid = 10118
- COMMIT/*!*/;
- # at 928
- #180805 23:55:58 server id 6 end_log_pos 1002 CRC32 0xaa5b0537 Query thread_id=13 exec_time=0 error_code=0
- SET TIMESTAMP=1533484558/*!*/;
- BEGIN
- /*!*/;
- # at 1002
- #180805 23:55:58 server id 6 end_log_pos 1049 CRC32 0xef25a191 Table_map: `oldboy`.`t1` mapped to number 324
- # at 1049
- #180805 23:55:58 server id 6 end_log_pos 1095 CRC32 0x93732ae2 Update_rows: table id 324 flags: STMT_END_F
- ### UPDATE `oldboy`.`t1`
- ### WHERE
- ### @1=2 /* INT meta=0 nullable=1 is_null=0 */
- ### SET
- ### @1=22 /* INT meta=0 nullable=1 is_null=0 */
- # at 1095
- #180805 23:55:58 server id 6 end_log_pos 1126 CRC32 0xfeee4a7c Xid = 10119
- COMMIT/*!*/;
- # at 1126
- #180805 23:56:04 server id 6 end_log_pos 1200 CRC32 0x4134c384 Query thread_id=13 exec_time=0 error_code=0
- SET TIMESTAMP=1533484564/*!*/;
- BEGIN
- /*!*/;
- # at 1200
- #180805 23:56:04 server id 6 end_log_pos 1247 CRC32 0x3e17dba1 Table_map: `oldboy`.`t1` mapped to number 324
- # at 1247
- #180805 23:56:04 server id 6 end_log_pos 1293 CRC32 0x758c18dd Update_rows: table id 324 flags: STMT_END_F
- ### UPDATE `oldboy`.`t1`
- ### WHERE
- ### @1=3 /* INT meta=0 nullable=1 is_null=0 */
- ### SET
- ### @1=33 /* INT meta=0 nullable=1 is_null=0 */
- # at 1293
- #180805 23:56:04 server id 6 end_log_pos 1324 CRC32 0x2838e762 Xid = 10120
- COMMIT/*!*/;
- # at 1324
- #180805 23:56:09 server id 6 end_log_pos 1398 CRC32 0x3101a798 Query thread_id=13 exec_time=0 error_code=0
- SET TIMESTAMP=1533484569/*!*/;
- BEGIN
- /*!*/;
- # at 1398
- #180805 23:56:09 server id 6 end_log_pos 1445 CRC32 0x4173fe96 Table_map: `oldboy`.`t1` mapped to number 324
- # at 1445
- #180805 23:56:09 server id 6 end_log_pos 1485 CRC32 0xc1755087 Delete_rows: table id 324 flags: STMT_END_F
- ### DELETE FROM `oldboy`.`t1`
- ### WHERE
- ### @1=7 /* INT meta=0 nullable=1 is_null=0 */
- # at 1485
- #180805 23:56:09 server id 6 end_log_pos 1516 CRC32 0xeb175961 Xid = 10121
- COMMIT/*!*/;
- # at 1516
- #180805 23:56:43 server id 6 end_log_pos 1590 CRC32 0xce6b49dd Query thread_id=13 exec_time=0 error_code=0
- SET TIMESTAMP=1533484603/*!*/;
- BEGIN
- /*!*/;
- # at 1590
- #180805 23:56:43 server id 6 end_log_pos 1637 CRC32 0xcc5d90fa Table_map: `oldboy`.`t1` mapped to number 324
- # at 1637
- #180805 23:56:43 server id 6 end_log_pos 1702 CRC32 0x67646caa Delete_rows: table id 324 flags: STMT_END_F
- ### DELETE FROM `oldboy`.`t1`
- ### WHERE
- ### @1=11 /* INT meta=0 nullable=1 is_null=0 */
- ### DELETE FROM `oldboy`.`t1`
- ### WHERE
- ### @1=22 /* INT meta=0 nullable=1 is_null=0 */
- ### DELETE FROM `oldboy`.`t1`
- ### WHERE
- ### @1=33 /* INT meta=0 nullable=1 is_null=0 */
- ### DELETE FROM `oldboy`.`t1`
- ### WHERE
- ### @1=4 /* INT meta=0 nullable=1 is_null=0 */
- ### DELETE FROM `oldboy`.`t1`
- ### WHERE
- ### @1=5 /* INT meta=0 nullable=1 is_null=0 */
- ### DELETE FROM `oldboy`.`t1`
- ### WHERE
- ### @1=6 /* INT meta=0 nullable=1 is_null=0 */
- # at 1702
- #180805 23:56:43 server id 6 end_log_pos 1733 CRC32 0xda91d5fc Xid = 10122
- COMMIT/*!*/;
- # at 1733
- #180805 23:57:48 server id 6 end_log_pos 1807 CRC32 0x9c648b02 Query thread_id=13 exec_time=0 error_code=0
- SET TIMESTAMP=1533484668/*!*/;
- BEGIN
- /*!*/;
- # at 1807
- #180805 23:57:48 server id 6 end_log_pos 1854 CRC32 0x705c9c37 Table_map: `oldboy`.`t1` mapped to number 324
- # at 1854
- #180805 23:57:48 server id 6 end_log_pos 1914 CRC32 0xa37a228b Write_rows: table id 324 flags: STMT_END_F
- ### INSERT INTO `oldboy`.`t1`
- ### SET
- ### @1=8 /* INT meta=0 nullable=1 is_null=0 */
- ### INSERT INTO `oldboy`.`t1`
- ### SET
- ### @1=9 /* INT meta=0 nullable=1 is_null=0 */
- ### INSERT INTO `oldboy`.`t1`
- ### SET
- ### @1=10 /* INT meta=0 nullable=1 is_null=0 */
- ### INSERT INTO `oldboy`.`t1`
- ### SET
- ### @1=11 /* INT meta=0 nullable=1 is_null=0 */
- ### INSERT INTO `oldboy`.`t1`
- ### SET
- ### @1=12 /* INT meta=0 nullable=1 is_null=0 */
- # at 1914
- #180805 23:57:48 server id 6 end_log_pos 1945 CRC32 0x704ab243 Xid = 10125
- COMMIT/*!*/;
- # at 1945
- #180805 23:57:54 server id 6 end_log_pos 2019 CRC32 0x733a9b67 Query thread_id=13 exec_time=0 error_code=0
- SET TIMESTAMP=1533484674/*!*/;
- BEGIN
- /*!*/;
- # at 2019
- #180805 23:57:54 server id 6 end_log_pos 2066 CRC32 0xa8ee9f3a Table_map: `oldboy`.`t1` mapped to number 324
- # at 2066
- #180805 23:57:54 server id 6 end_log_pos 2112 CRC32 0x69de9370 Update_rows: table id 324 flags: STMT_END_F
- ### UPDATE `oldboy`.`t1`
- ### WHERE
- ### @1=10 /* INT meta=0 nullable=1 is_null=0 */
- ### SET
- ### @1=100 /* INT meta=0 nullable=1 is_null=0 */
- # at 2112
- #180805 23:57:54 server id 6 end_log_pos 2143 CRC32 0x436ebefc Xid = 10126
- COMMIT/*!*/;
- # at 2143
- #180805 23:57:59 server id 6 end_log_pos 2217 CRC32 0x40f410d1 Query thread_id=13 exec_time=0 error_code=0
- SET TIMESTAMP=1533484679/*!*/;
- BEGIN
- /*!*/;
- # at 2217
- #180805 23:57:59 server id 6 end_log_pos 2264 CRC32 0x413676a6 Table_map: `oldboy`.`t1` mapped to number 324
- # at 2264
- #180805 23:57:59 server id 6 end_log_pos 2310 CRC32 0xbf31e991 Update_rows: table id 324 flags: STMT_END_F
- ### UPDATE `oldboy`.`t1`
- ### WHERE
- ### @1=11 /* INT meta=0 nullable=1 is_null=0 */
- ### SET
- ### @1=110 /* INT meta=0 nullable=1 is_null=0 */
- # at 2310
- #180805 23:57:59 server id 6 end_log_pos 2341 CRC32 0x65c77e3d Xid = 10127
- COMMIT/*!*/;
- # at 2341
- #180805 23:58:03 server id 6 end_log_pos 2415 CRC32 0x69a74ca6 Query thread_id=13 exec_time=0 error_code=0
- SET TIMESTAMP=1533484683/*!*/;
- BEGIN
- /*!*/;
- # at 2415
- #180805 23:58:03 server id 6 end_log_pos 2462 CRC32 0x2180734d Table_map: `oldboy`.`t1` mapped to number 324
- # at 2462
- #180805 23:58:03 server id 6 end_log_pos 2508 CRC32 0xbdcc9544 Update_rows: table id 324 flags: STMT_END_F
- ### UPDATE `oldboy`.`t1`
- ### WHERE
- ### @1=12 /* INT meta=0 nullable=1 is_null=0 */
- ### SET
- ### @1=120 /* INT meta=0 nullable=1 is_null=0 */
- # at 2508
- #180805 23:58:03 server id 6 end_log_pos 2539 CRC32 0x6aceade6 Xid = 10128
- COMMIT/*!*/;
- # at 2539
- #180806 0:02:12 server id 6 end_log_pos 2586 CRC32 0xad6d9bf8 Rotate to mysql-bin.000014 pos: 4
- DELIMITER ;
- # End of log file
- ROLLBACK /* added by mysqlbinlog */;
- /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
- /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
MySQL binlog 企业案例升级版的更多相关文章
- MySQL mysqlbinlog企业案例
内容待补充 案例文字说明: 7.3 故障时间点: 周四上午10点,开发人员误删除了一个表,如何恢复? 7.4 思路: 1.停业务,避免数据的二次伤害 2.找一个临时库,恢复周三23:00全备 3.截取 ...
- Mysql binlog应用场景与原理深度剖析
1 基于binlog的主从复制 Mysql 5.0以后,支持通过binary log(二进制日志)以支持主从复制.复制允许将来自一个MySQL数据库服务器(master) 的数据复制到一个或多个其他M ...
- MySQL数据库企业集群项目实战(阶段三)
MySQL数据库企业集群项目实战(阶段三) 作者 刘畅 时间 2020-10-25 目录 1 架构拓扑图 1 1.1 方案一 1 1.2 方案二 2 ...
- MySQL Binlog Mixed模式记录成Row格式
背景: 一个简单的主从结构,主的binlog format是Mixed模式,在执行一条简单的导入语句时,通过mysqlbinlog导出发现记录的Binlog全部变成了Row的格式(明明设置的是Mixe ...
- MySQL Binlog详解
MySQL Binlog详解 Mysql的binlog日志作用是用来记录mysql内部增删改查等对mysql数据库有更新的内容的记录(对数据库的改动),对数据库的查询select或show等不会被bi ...
- 原创工具binlog2sql:从MySQL binlog得到你要的SQL
从MySQL binlog得到你要的SQL.根据不同设置,你可以得到原始SQL.回滚SQL.去除主键的INSERT SQL等. 用途 数据回滚 主从切换后数据不一致的修复 从binlog生成标准SQL ...
- MySQL binlog中的事件类型
MySQL binlog记录的所有操作实际上都有对应的事件类型的,譬如STATEMENT格式中的DML操作对应的是QUERY_EVENT类型,ROW格式下的DML操作对应的是ROWS_EVENT类型. ...
- MySQL binlog的格式解析
我搜集到了一些资料,对理解代码比较有帮助. 在头文件中binlog_event.h中,有描述 class Log_event_header class Log_event_footer 参见[Myst ...
- Mysql binlog
理解Mysql binlog 日志的三种模式 本文介绍下,mysql中binlog日志的三种模式,了解了各种模式的不同之处,才能更好地应用.有需要的朋友建议参考下. 一,模式1 Row Lev ...
随机推荐
- golang sublime text3 自动补全
按下快捷键 command+ shift +p 调出控制台 输入install 然后输入Golang Tools Integration 安装Golang Tools Integration 插件即 ...
- MySQL Lock--MySQL加锁规则
===================================================================== 淘宝林晓斌总结 在可重复读事务隔离级别下,加锁规则如下: 原 ...
- openresty 编译ngx_pagespeed 模块-docker 构建
ngx_pagespeed 是一个很不错的web 优化模块,我们通过简单的配置就可以对于web页面的加载有很大的提升 ngx_pagespeed 依赖psol 模块 Dockerfile # Do ...
- 01Hadoop简介
Hadoop思想之源:Google 面对的数据和计算难题 ——大量的网页怎么存储 ——搜索算法 带给我们的关键技术和思想(Google三篇论文) ——GFS(hdfs) ——Map-Reduce —— ...
- Android学习--------实现增删改查数据库操作以及实现相似微信好友对话管理操作
版权声明:本文为博主原创文章,转载请注明原文地址.谢谢~ https://blog.csdn.net/u011250851/article/details/26169409 近期的一个实验用到东西挺多 ...
- promise对象的回调函数resolve的参数为另一个promise对象
/*如果调用resolve函数和reject函数时带有参数,那么它们的参数会被传递给回调函数. reject函数的参数通常是Error对象的实例,表示抛出的错误: resolve函数的参数除了正常的值 ...
- Spring+SpringMVC+mybatis框架整合
1.jdbc.properties 1 driverClassName=com.mysql.jdbc.Driver 2 url=jdbc\:mysql\://127.0.0.1\:3306/slsal ...
- ML: 聚类算法R包-K中心点聚类
K-medodis与K-means比较相似,但是K-medoids和K-means是有区别的,不一样的地方在于中心点的选取,在K-means中,我们将中心点取为当前cluster中所有数据点的平均值, ...
- MySQL 使用profile分析慢sql,group left join效率高于子查询
MySQL 使用profile分析慢sql,group left join效率高于子查询 http://blog.csdn.net/mchdba/article/details/54380221 -- ...
- 代码编辑器之sublime text
http://www.iplaysoft.com/sublimetext.html 1.特点: 中文乱码问题:另外,很多朋友反映表示打开中文会有乱码,其实是因为ST2本身只支持UTF-8编码,而我们常 ...