需求:
1、创建一个数据库 oldboy
2、在oldboy下创建一张表t1
3、插入5行任意数据
4、全备
5、插入两行数据,任意修改3行数据,删除1行数据
6、删除所有数据
7、再t1中又插入5行新数据,修改3行数据
需求,跳过第六步恢复表数据

分析问题解决问题

1 如果没有误操作 数据会是什么样 先模拟

  1. #-------------------------------------------------------------------------------
  2. #
  3. # day8 练习
  4. # Author:nod
  5. # Date:18-08-05
  6. #-------------------------------------------------------------------------------
  7.  
  8. #-------------------------------------------------------------------------------
  9. #
  10. # 本次练习题当中6为误操作,因而处理方式就是跳过第六步看看正常数据如何
  11. # 再按步骤1-7在主库上进行操作 恢复数据等进行测试
  12. #-------------------------------------------------------------------------------
  13.  
  14. 需求:
  15. 1、创建一个数据库 oldboy
  16. 2、在oldboy下创建一张表t1
  17. 3、插入5行任意数据
  18. 4、全备
  19. 5、插入两行数据,任意修改3行数据,删除1行数据
  20. 6、删除所有数据
  21. 7、再t1中又插入5行新数据,修改3行数据
  22. 需求,跳过第六步恢复表数据
  23.  
  24. mysql> create database oldboy;
  25. mysql> use oldboy;
  26. mysql> create table t1(id int);
  27. mysql> insert into t1 values(1),(2),(3),(4),(5);
  28. mysql> select * from t1;
  29. +------+
  30. | id |
  31. +------+
  32. | 1 |
  33. | 2 |
  34. | 3 |
  35. | 4 |
  36. | 5 |
  37. +------+
  38.  
  39. # 插入两行数据,任意修改3行数据,删除1行数据
  40. mysql> insert into t1 values(6),(7);
  41. mysql> update t1 set id=11 where id=1;
  42. mysql> update t1 set id=22 where id=2;
  43. mysql> update t1 set id=33 where id=3;
  44. mysql> delete from t1 where id=7;
  45.  
  46. # 再t1中又插入5行新数据,修改3行数据
  47. mysql> insert into t1 values(8),(9),(10),(11),(12);
  48. mysql> update t1 set id=100 where id=10;
  49. mysql> update t1 set id=110 where id=11;
  50. mysql> update t1 set id=120 where id=12;
  51.  
  52. # 正确效果数据
  53. mysql> select * from t1;
  54. +------+
  55. | id |
  56. +------+
  57. | 110 |
  58. | 22 |
  59. | 33 |
  60. | 4 |
  61. | 5 |
  62. | 6 |
  63. | 8 |
  64. | 9 |
  65. | 100 |
  66. | 110 |
  67. | 120 |
  68. +------+

分析后得出对应的解决方法

全备恢复 +第5步骤+第七步骤 跳过第六步骤 需要对mysqlbinlog进行分析

  1. #-------------------------------------------------------------------------------
  2. #
  3. # day8 练习实际步骤
  4. # Author:nod
  5. # Date:18-08-05
  6. #-------------------------------------------------------------------------------
  7.  
  8. 需求:
  9. 1、创建一个数据库 oldboy
  10. 2、在oldboy下创建一张表t1
  11. 3、插入5行任意数据
  12. 4、全备
  13. 5、插入两行数据,任意修改3行数据,删除1行数据
  14. 6、删除所有数据
  15. 7、再t1中又插入5行新数据,修改3行数据
  16. 需求,跳过第六步恢复表数据
  17.  
  18. #-------------------------------------------------------------------------------
  19. # 1-3步骤
  20. #-------------------------------------------------------------------------------
  21. mysql> flush logs;
  22. mysql> create database oldboy;
  23. mysql> use oldboy;
  24. Database changed
  25. mysql> create table t1(id int);
  26. mysql> insert into t1 values(1),(2),(3),(4),(5);
  27.  
  28. #-------------------------------------------------------------------------------
  29. # 全备
  30. #-------------------------------------------------------------------------------
  31.  
  32. mysqldump -uroot -p123 -A -R --triggers --master-data=2 --single-transaction > /backup/full3.sql
  33.  
  34. #-------------------------------------------------------------------------------
  35. # 5 插入两行数据,任意修改3行数据,删除1行数据
  36. #-------------------------------------------------------------------------------
  37.  
  38. mysql> insert into t1 values(6),(7);
  39. mysql> update t1 set id=11 where id=1;
  40. mysql> update t1 set id=22 where id=2;
  41. mysql> update t1 set id=33 where id=3;
  42. mysql> delete from t1 where id=7;
  43.  
  44. #-------------------------------------------------------------------------------
  45. # 6 删除所有数据 1637
  46. #-------------------------------------------------------------------------------
  47. #
  48. mysql> delete from t1;
  49.  
  50. #-------------------------------------------------------------------------------
  51. # 7 再t1中又插入5行新数据,修改3行数据
  52. #-------------------------------------------------------------------------------
  53. mysql> insert into t1 values(8),(9),(10),(11),(12); 1702 2586
  54. mysql> update t1 set id=100 where id=10;
  55. mysql> update t1 set id=110 where id=11;
  56. mysql> update t1 set id=120 where id=12;
  57.  
  58. #-------------------------------------------------------------------------------
  59. # 脏数据
  60. #-------------------------------------------------------------------------------
  61. mysql> select * from t1;
  62. +------+
  63. | id |
  64. +------+
  65. | 8 |
  66. | 9 |
  67. | 100 |
  68. | 110 |
  69. | 120 |
  70. +------+
  71. 5 rows in set (0.00 sec)
  72.  
  73. #-------------------------------------------------------------------------------
  74. # 数据处理部分
  75. #-------------------------------------------------------------------------------
  76. #
  77.  
  78. #-------------------------------------------------------------------------------
  79. # 数据分析/backup/full3.sql
  80. #-------------------------------------------------------------------------------
  81.  
  82. 22CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000013', MASTER_LOG_POS=533;
  83.  
  84. #-------------------------------------------------------------------------------
  85. # 数据分析mysql-bin.000013
  86. #-------------------------------------------------------------------------------
  87. mysqlbinlog --base64-output=decode-rows -vvv /data/mysql/mysql-bin.000013
  88. mysqlbinlog --start-position=533 --stop-position=1590 /data/mysql/mysql-bin.000013 >/backup/inc1.sql
  89. mysqlbinlog --start-position=1702 --stop-position=2586 /data/mysql/mysql-bin.000013 >/backup/inc2.sql
  90.  
  91. #-------------------------------------------------------------------------------
  92. # 在备份库上进行主库全备恢复+步骤6 步骤7操作恢复
  93. #-------------------------------------------------------------------------------
  94. mysql> source /backup/full3.sql;
  95. mysql> source /backup/inc1.sql
  96. mysql> source /backup/inc2.sql
  97.  
  98. #-------------------------------------------------------------------------------
  99. # ERROR 1666 (HY000): Cannot execute statement: impossible to write to binary log since statement is in row # # format and BINLOG_FORMAT = STATEMENT.
  100. # 解决方法:
  101. # 主库是row模式 因而备份库也要row模式 修改后解决
  102. #-------------------------------------------------------------------------------
  103.  
  104. #-------------------------------------------------------------------------------
  105. # 验证数据 数据恢复正确
  106. #-------------------------------------------------------------------------------
  107. mysql> select * from t1;
  108. +------+
  109. | id |
  110. +------+
  111. | 110 |
  112. | 22 |
  113. | 33 |
  114. | 4 |
  115. | 5 |
  116. | 6 |
  117. | 8 |
  118. | 9 |
  119. | 100 |
  120. | 11 |
  121. | 120 |
  122. +------+
  123. 11 rows in set (0.00 sec)
  124.  
  125. #-------------------------------------------------------------------------------
  126. # 将带有误操作(删除)的t1表导出
  127. #-------------------------------------------------------------------------------
  128. [root@db01 backup]# mysqldump -uroot -p123 -S /data/3307/mysql.sock oldboy t1 >/backup/t1.sql
  129.  
  130. #-------------------------------------------------------------------------------
  131. # 主库进行恢复t1表操作
  132. #-------------------------------------------------------------------------------
  133.  
  134. #-------------------------------------------------------------------------------
  135. # 查看oldboy下t1的数据,目前数据应该是有问题的数据
  136. #-------------------------------------------------------------------------------
  137. mysql> use oldboy;
  138. mysql> select * from t1;
  139. +------+
  140. | id |
  141. +------+
  142. | 8 |
  143. | 9 |
  144. | 100 |
  145. | 110 |
  146. | 120 |
  147. +------+
  148. 5 rows in set (0.00 sec)
  149.  
  150. #-------------------------------------------------------------------------------
  151. # 开始恢复t1操作
  152. #-------------------------------------------------------------------------------
  153. mysql> source /backup/t1.sql;
  154. Query OK, 0 rows affected (0.00 sec)
  155.  
  156. Query OK, 0 rows affected (0.00 sec)
  157.  
  158. Query OK, 0 rows affected (0.00 sec)
  159.  
  160. Query OK, 0 rows affected (0.00 sec)
  161.  
  162. Query OK, 0 rows affected (0.00 sec)
  163.  
  164. Query OK, 0 rows affected (0.00 sec)
  165.  
  166. Query OK, 0 rows affected (0.00 sec)
  167.  
  168. Query OK, 0 rows affected (0.00 sec)
  169.  
  170. Query OK, 0 rows affected (0.00 sec)
  171.  
  172. Query OK, 0 rows affected (0.00 sec)
  173.  
  174. Query OK, 0 rows affected (0.02 sec)
  175.  
  176. Query OK, 0 rows affected (0.00 sec)
  177.  
  178. Query OK, 0 rows affected (0.00 sec)
  179.  
  180. Query OK, 0 rows affected (0.07 sec)
  181.  
  182. Query OK, 0 rows affected (0.00 sec)
  183.  
  184. Query OK, 0 rows affected (0.01 sec)
  185.  
  186. Query OK, 0 rows affected (0.00 sec)
  187.  
  188. Query OK, 11 rows affected (0.01 sec)
  189. Records: 11 Duplicates: 0 Warnings: 0
  190.  
  191. Query OK, 0 rows affected (0.00 sec)
  192.  
  193. Query OK, 0 rows affected (0.00 sec)
  194.  
  195. Query OK, 0 rows affected (0.00 sec)
  196.  
  197. Query OK, 0 rows affected (0.00 sec)
  198.  
  199. Query OK, 0 rows affected (0.00 sec)
  200.  
  201. Query OK, 0 rows affected (0.00 sec)
  202.  
  203. Query OK, 0 rows affected (0.00 sec)
  204.  
  205. Query OK, 0 rows affected (0.00 sec)
  206.  
  207. Query OK, 0 rows affected (0.00 sec)
  208.  
  209. Query OK, 0 rows affected (0.00 sec)
  210.  
  211. #-------------------------------------------------------------------------------
  212. # 恢复完毕 检查数据 恢复操作完成
  213. #-------------------------------------------------------------------------------
  214.  
  215. mysql> select * from t1;
  216. +------+
  217. | id |
  218. +------+
  219. | 110 |
  220. | 22 |
  221. | 33 |
  222. | 4 |
  223. | 5 |
  224. | 6 |
  225. | 8 |
  226. | 9 |
  227. | 100 |
  228. | 11 |
  229. | 120 |
  230. +------+
  231. 11 rows in set (0.00 sec)

分析的binlogcode

要对比分析begin commit 要多加体会

  1. #-------------------------------------------------------------------------------
  2. #
  3. # day8练习题binlog文件
  4. #-------------------------------------------------------------------------------
  5.  
  6. [root@db01 backup]# mysqlbinlog --base64-output=decode-rows -vvv /data/mysql/mysql-bin.000013
  7. /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
  8. /*!40019 SET @@session.max_insert_delayed_threads=0*/;
  9. /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
  10. DELIMITER /*!*/;
  11. # at 4
  12. #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
  13. # at 120
  14. #180805 23:51:36 server id 6 end_log_pos 220 CRC32 0xeaa89679 Query thread_id=13 exec_time=0 error_code=0
  15. SET TIMESTAMP=1533484296/*!*/;
  16. SET @@session.pseudo_thread_id=13/*!*/;
  17. SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
  18. SET @@session.sql_mode=1075838976/*!*/;
  19. SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
  20. /*!\C utf8 *//*!*/;
  21. SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=33/*!*/;
  22. SET @@session.lc_time_names=0/*!*/;
  23. SET @@session.collation_database=DEFAULT/*!*/;
  24. create database oldboy
  25. /*!*/;
  26. # at 220
  27. #180805 23:52:19 server id 6 end_log_pos 321 CRC32 0x23a9496d Query thread_id=13 exec_time=0 error_code=0
  28. use `oldboy`/*!*/;
  29. SET TIMESTAMP=1533484339/*!*/;
  30. create table t1(id int)
  31. /*!*/;
  32. # at 321
  33. #180805 23:52:30 server id 6 end_log_pos 395 CRC32 0x73300da7 Query thread_id=13 exec_time=0 error_code=0
  34. SET TIMESTAMP=1533484350/*!*/;
  35. BEGIN
  36. /*!*/;
  37. # at 395
  38. #180805 23:52:30 server id 6 end_log_pos 442 CRC32 0xe87526c3 Table_map: `oldboy`.`t1` mapped to number 283
  39. # at 442
  40. #180805 23:52:30 server id 6 end_log_pos 502 CRC32 0x681dd9f1 Write_rows: table id 283 flags: STMT_END_F
  41. ### INSERT INTO `oldboy`.`t1`
  42. ### SET
  43. ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
  44. ### INSERT INTO `oldboy`.`t1`
  45. ### SET
  46. ### @1=2 /* INT meta=0 nullable=1 is_null=0 */
  47. ### INSERT INTO `oldboy`.`t1`
  48. ### SET
  49. ### @1=3 /* INT meta=0 nullable=1 is_null=0 */
  50. ### INSERT INTO `oldboy`.`t1`
  51. ### SET
  52. ### @1=4 /* INT meta=0 nullable=1 is_null=0 */
  53. ### INSERT INTO `oldboy`.`t1`
  54. ### SET
  55. ### @1=5 /* INT meta=0 nullable=1 is_null=0 */
  56. # at 502
  57. #180805 23:52:30 server id 6 end_log_pos 533 CRC32 0x0b8ae04d Xid = 9250
  58. COMMIT/*!*/;
  59. # at 533
  60. #180805 23:55:47 server id 6 end_log_pos 607 CRC32 0x9df4f1c1 Query thread_id=13 exec_time=0 error_code=0
  61. SET TIMESTAMP=1533484547/*!*/;
  62. BEGIN
  63. /*!*/;
  64. # at 607
  65. #180805 23:55:47 server id 6 end_log_pos 654 CRC32 0x5f289eed Table_map: `oldboy`.`t1` mapped to number 324
  66. # at 654
  67. #180805 23:55:47 server id 6 end_log_pos 699 CRC32 0x56cbcd59 Write_rows: table id 324 flags: STMT_END_F
  68. ### INSERT INTO `oldboy`.`t1`
  69. ### SET
  70. ### @1=6 /* INT meta=0 nullable=1 is_null=0 */
  71. ### INSERT INTO `oldboy`.`t1`
  72. ### SET
  73. ### @1=7 /* INT meta=0 nullable=1 is_null=0 */
  74. # at 699
  75. #180805 23:55:47 server id 6 end_log_pos 730 CRC32 0xd3310e29 Xid = 10117
  76. COMMIT/*!*/;
  77. # at 730
  78. #180805 23:55:52 server id 6 end_log_pos 804 CRC32 0x4fa560fa Query thread_id=13 exec_time=0 error_code=0
  79. SET TIMESTAMP=1533484552/*!*/;
  80. BEGIN
  81. /*!*/;
  82. # at 804
  83. #180805 23:55:52 server id 6 end_log_pos 851 CRC32 0x0c2cb62f Table_map: `oldboy`.`t1` mapped to number 324
  84. # at 851
  85. #180805 23:55:52 server id 6 end_log_pos 897 CRC32 0x7641ef30 Update_rows: table id 324 flags: STMT_END_F
  86. ### UPDATE `oldboy`.`t1`
  87. ### WHERE
  88. ### @1=1 /* INT meta=0 nullable=1 is_null=0 */
  89. ### SET
  90. ### @1=11 /* INT meta=0 nullable=1 is_null=0 */
  91. # at 897
  92. #180805 23:55:52 server id 6 end_log_pos 928 CRC32 0xc96642d8 Xid = 10118
  93. COMMIT/*!*/;
  94. # at 928
  95. #180805 23:55:58 server id 6 end_log_pos 1002 CRC32 0xaa5b0537 Query thread_id=13 exec_time=0 error_code=0
  96. SET TIMESTAMP=1533484558/*!*/;
  97. BEGIN
  98. /*!*/;
  99. # at 1002
  100. #180805 23:55:58 server id 6 end_log_pos 1049 CRC32 0xef25a191 Table_map: `oldboy`.`t1` mapped to number 324
  101. # at 1049
  102. #180805 23:55:58 server id 6 end_log_pos 1095 CRC32 0x93732ae2 Update_rows: table id 324 flags: STMT_END_F
  103. ### UPDATE `oldboy`.`t1`
  104. ### WHERE
  105. ### @1=2 /* INT meta=0 nullable=1 is_null=0 */
  106. ### SET
  107. ### @1=22 /* INT meta=0 nullable=1 is_null=0 */
  108. # at 1095
  109. #180805 23:55:58 server id 6 end_log_pos 1126 CRC32 0xfeee4a7c Xid = 10119
  110. COMMIT/*!*/;
  111. # at 1126
  112. #180805 23:56:04 server id 6 end_log_pos 1200 CRC32 0x4134c384 Query thread_id=13 exec_time=0 error_code=0
  113. SET TIMESTAMP=1533484564/*!*/;
  114. BEGIN
  115. /*!*/;
  116. # at 1200
  117. #180805 23:56:04 server id 6 end_log_pos 1247 CRC32 0x3e17dba1 Table_map: `oldboy`.`t1` mapped to number 324
  118. # at 1247
  119. #180805 23:56:04 server id 6 end_log_pos 1293 CRC32 0x758c18dd Update_rows: table id 324 flags: STMT_END_F
  120. ### UPDATE `oldboy`.`t1`
  121. ### WHERE
  122. ### @1=3 /* INT meta=0 nullable=1 is_null=0 */
  123. ### SET
  124. ### @1=33 /* INT meta=0 nullable=1 is_null=0 */
  125. # at 1293
  126. #180805 23:56:04 server id 6 end_log_pos 1324 CRC32 0x2838e762 Xid = 10120
  127. COMMIT/*!*/;
  128. # at 1324
  129. #180805 23:56:09 server id 6 end_log_pos 1398 CRC32 0x3101a798 Query thread_id=13 exec_time=0 error_code=0
  130. SET TIMESTAMP=1533484569/*!*/;
  131. BEGIN
  132. /*!*/;
  133. # at 1398
  134. #180805 23:56:09 server id 6 end_log_pos 1445 CRC32 0x4173fe96 Table_map: `oldboy`.`t1` mapped to number 324
  135. # at 1445
  136. #180805 23:56:09 server id 6 end_log_pos 1485 CRC32 0xc1755087 Delete_rows: table id 324 flags: STMT_END_F
  137. ### DELETE FROM `oldboy`.`t1`
  138. ### WHERE
  139. ### @1=7 /* INT meta=0 nullable=1 is_null=0 */
  140. # at 1485
  141. #180805 23:56:09 server id 6 end_log_pos 1516 CRC32 0xeb175961 Xid = 10121
  142. COMMIT/*!*/;
  143. # at 1516
  144. #180805 23:56:43 server id 6 end_log_pos 1590 CRC32 0xce6b49dd Query thread_id=13 exec_time=0 error_code=0
  145. SET TIMESTAMP=1533484603/*!*/;
  146. BEGIN
  147. /*!*/;
  148. # at 1590
  149. #180805 23:56:43 server id 6 end_log_pos 1637 CRC32 0xcc5d90fa Table_map: `oldboy`.`t1` mapped to number 324
  150. # at 1637
  151. #180805 23:56:43 server id 6 end_log_pos 1702 CRC32 0x67646caa Delete_rows: table id 324 flags: STMT_END_F
  152. ### DELETE FROM `oldboy`.`t1`
  153. ### WHERE
  154. ### @1=11 /* INT meta=0 nullable=1 is_null=0 */
  155. ### DELETE FROM `oldboy`.`t1`
  156. ### WHERE
  157. ### @1=22 /* INT meta=0 nullable=1 is_null=0 */
  158. ### DELETE FROM `oldboy`.`t1`
  159. ### WHERE
  160. ### @1=33 /* INT meta=0 nullable=1 is_null=0 */
  161. ### DELETE FROM `oldboy`.`t1`
  162. ### WHERE
  163. ### @1=4 /* INT meta=0 nullable=1 is_null=0 */
  164. ### DELETE FROM `oldboy`.`t1`
  165. ### WHERE
  166. ### @1=5 /* INT meta=0 nullable=1 is_null=0 */
  167. ### DELETE FROM `oldboy`.`t1`
  168. ### WHERE
  169. ### @1=6 /* INT meta=0 nullable=1 is_null=0 */
  170. # at 1702
  171. #180805 23:56:43 server id 6 end_log_pos 1733 CRC32 0xda91d5fc Xid = 10122
  172. COMMIT/*!*/;
  173. # at 1733
  174. #180805 23:57:48 server id 6 end_log_pos 1807 CRC32 0x9c648b02 Query thread_id=13 exec_time=0 error_code=0
  175. SET TIMESTAMP=1533484668/*!*/;
  176. BEGIN
  177. /*!*/;
  178. # at 1807
  179. #180805 23:57:48 server id 6 end_log_pos 1854 CRC32 0x705c9c37 Table_map: `oldboy`.`t1` mapped to number 324
  180. # at 1854
  181. #180805 23:57:48 server id 6 end_log_pos 1914 CRC32 0xa37a228b Write_rows: table id 324 flags: STMT_END_F
  182. ### INSERT INTO `oldboy`.`t1`
  183. ### SET
  184. ### @1=8 /* INT meta=0 nullable=1 is_null=0 */
  185. ### INSERT INTO `oldboy`.`t1`
  186. ### SET
  187. ### @1=9 /* INT meta=0 nullable=1 is_null=0 */
  188. ### INSERT INTO `oldboy`.`t1`
  189. ### SET
  190. ### @1=10 /* INT meta=0 nullable=1 is_null=0 */
  191. ### INSERT INTO `oldboy`.`t1`
  192. ### SET
  193. ### @1=11 /* INT meta=0 nullable=1 is_null=0 */
  194. ### INSERT INTO `oldboy`.`t1`
  195. ### SET
  196. ### @1=12 /* INT meta=0 nullable=1 is_null=0 */
  197. # at 1914
  198. #180805 23:57:48 server id 6 end_log_pos 1945 CRC32 0x704ab243 Xid = 10125
  199. COMMIT/*!*/;
  200. # at 1945
  201. #180805 23:57:54 server id 6 end_log_pos 2019 CRC32 0x733a9b67 Query thread_id=13 exec_time=0 error_code=0
  202. SET TIMESTAMP=1533484674/*!*/;
  203. BEGIN
  204. /*!*/;
  205. # at 2019
  206. #180805 23:57:54 server id 6 end_log_pos 2066 CRC32 0xa8ee9f3a Table_map: `oldboy`.`t1` mapped to number 324
  207. # at 2066
  208. #180805 23:57:54 server id 6 end_log_pos 2112 CRC32 0x69de9370 Update_rows: table id 324 flags: STMT_END_F
  209. ### UPDATE `oldboy`.`t1`
  210. ### WHERE
  211. ### @1=10 /* INT meta=0 nullable=1 is_null=0 */
  212. ### SET
  213. ### @1=100 /* INT meta=0 nullable=1 is_null=0 */
  214. # at 2112
  215. #180805 23:57:54 server id 6 end_log_pos 2143 CRC32 0x436ebefc Xid = 10126
  216. COMMIT/*!*/;
  217. # at 2143
  218. #180805 23:57:59 server id 6 end_log_pos 2217 CRC32 0x40f410d1 Query thread_id=13 exec_time=0 error_code=0
  219. SET TIMESTAMP=1533484679/*!*/;
  220. BEGIN
  221. /*!*/;
  222. # at 2217
  223. #180805 23:57:59 server id 6 end_log_pos 2264 CRC32 0x413676a6 Table_map: `oldboy`.`t1` mapped to number 324
  224. # at 2264
  225. #180805 23:57:59 server id 6 end_log_pos 2310 CRC32 0xbf31e991 Update_rows: table id 324 flags: STMT_END_F
  226. ### UPDATE `oldboy`.`t1`
  227. ### WHERE
  228. ### @1=11 /* INT meta=0 nullable=1 is_null=0 */
  229. ### SET
  230. ### @1=110 /* INT meta=0 nullable=1 is_null=0 */
  231. # at 2310
  232. #180805 23:57:59 server id 6 end_log_pos 2341 CRC32 0x65c77e3d Xid = 10127
  233. COMMIT/*!*/;
  234. # at 2341
  235. #180805 23:58:03 server id 6 end_log_pos 2415 CRC32 0x69a74ca6 Query thread_id=13 exec_time=0 error_code=0
  236. SET TIMESTAMP=1533484683/*!*/;
  237. BEGIN
  238. /*!*/;
  239. # at 2415
  240. #180805 23:58:03 server id 6 end_log_pos 2462 CRC32 0x2180734d Table_map: `oldboy`.`t1` mapped to number 324
  241. # at 2462
  242. #180805 23:58:03 server id 6 end_log_pos 2508 CRC32 0xbdcc9544 Update_rows: table id 324 flags: STMT_END_F
  243. ### UPDATE `oldboy`.`t1`
  244. ### WHERE
  245. ### @1=12 /* INT meta=0 nullable=1 is_null=0 */
  246. ### SET
  247. ### @1=120 /* INT meta=0 nullable=1 is_null=0 */
  248. # at 2508
  249. #180805 23:58:03 server id 6 end_log_pos 2539 CRC32 0x6aceade6 Xid = 10128
  250. COMMIT/*!*/;
  251. # at 2539
  252. #180806 0:02:12 server id 6 end_log_pos 2586 CRC32 0xad6d9bf8 Rotate to mysql-bin.000014 pos: 4
  253. DELIMITER ;
  254. # End of log file
  255. ROLLBACK /* added by mysqlbinlog */;
  256. /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
  257. /*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;

MySQL binlog 企业案例升级版的更多相关文章

  1. MySQL mysqlbinlog企业案例

    内容待补充 案例文字说明: 7.3 故障时间点: 周四上午10点,开发人员误删除了一个表,如何恢复? 7.4 思路: 1.停业务,避免数据的二次伤害 2.找一个临时库,恢复周三23:00全备 3.截取 ...

  2. Mysql binlog应用场景与原理深度剖析

    1 基于binlog的主从复制 Mysql 5.0以后,支持通过binary log(二进制日志)以支持主从复制.复制允许将来自一个MySQL数据库服务器(master) 的数据复制到一个或多个其他M ...

  3. MySQL数据库企业集群项目实战(阶段三)

                              MySQL数据库企业集群项目实战(阶段三) 作者 刘畅 时间 2020-10-25 目录 1 架构拓扑图 1 1.1 方案一 1 1.2 方案二 2 ...

  4. MySQL Binlog Mixed模式记录成Row格式

    背景: 一个简单的主从结构,主的binlog format是Mixed模式,在执行一条简单的导入语句时,通过mysqlbinlog导出发现记录的Binlog全部变成了Row的格式(明明设置的是Mixe ...

  5. MySQL Binlog详解

    MySQL Binlog详解 Mysql的binlog日志作用是用来记录mysql内部增删改查等对mysql数据库有更新的内容的记录(对数据库的改动),对数据库的查询select或show等不会被bi ...

  6. 原创工具binlog2sql:从MySQL binlog得到你要的SQL

    从MySQL binlog得到你要的SQL.根据不同设置,你可以得到原始SQL.回滚SQL.去除主键的INSERT SQL等. 用途 数据回滚 主从切换后数据不一致的修复 从binlog生成标准SQL ...

  7. MySQL binlog中的事件类型

    MySQL binlog记录的所有操作实际上都有对应的事件类型的,譬如STATEMENT格式中的DML操作对应的是QUERY_EVENT类型,ROW格式下的DML操作对应的是ROWS_EVENT类型. ...

  8. MySQL binlog的格式解析

    我搜集到了一些资料,对理解代码比较有帮助. 在头文件中binlog_event.h中,有描述 class Log_event_header class Log_event_footer 参见[Myst ...

  9. Mysql binlog

    理解Mysql binlog 日志的三种模式   本文介绍下,mysql中binlog日志的三种模式,了解了各种模式的不同之处,才能更好地应用.有需要的朋友建议参考下.   一,模式1 Row Lev ...

随机推荐

  1. golang sublime text3 自动补全

    按下快捷键 command+ shift +p 调出控制台 输入install  然后输入Golang Tools Integration 安装Golang Tools Integration 插件即 ...

  2. MySQL Lock--MySQL加锁规则

    ===================================================================== 淘宝林晓斌总结 在可重复读事务隔离级别下,加锁规则如下: 原 ...

  3. openresty 编译ngx_pagespeed 模块-docker 构建

    ngx_pagespeed 是一个很不错的web 优化模块,我们通过简单的配置就可以对于web页面的加载有很大的提升 ngx_pagespeed 依赖psol 模块 Dockerfile   # Do ...

  4. 01Hadoop简介

    Hadoop思想之源:Google 面对的数据和计算难题 ——大量的网页怎么存储 ——搜索算法 带给我们的关键技术和思想(Google三篇论文) ——GFS(hdfs) ——Map-Reduce —— ...

  5. Android学习--------实现增删改查数据库操作以及实现相似微信好友对话管理操作

    版权声明:本文为博主原创文章,转载请注明原文地址.谢谢~ https://blog.csdn.net/u011250851/article/details/26169409 近期的一个实验用到东西挺多 ...

  6. promise对象的回调函数resolve的参数为另一个promise对象

    /*如果调用resolve函数和reject函数时带有参数,那么它们的参数会被传递给回调函数. reject函数的参数通常是Error对象的实例,表示抛出的错误: resolve函数的参数除了正常的值 ...

  7. Spring+SpringMVC+mybatis框架整合

    1.jdbc.properties 1 driverClassName=com.mysql.jdbc.Driver 2 url=jdbc\:mysql\://127.0.0.1\:3306/slsal ...

  8. ML: 聚类算法R包-K中心点聚类

    K-medodis与K-means比较相似,但是K-medoids和K-means是有区别的,不一样的地方在于中心点的选取,在K-means中,我们将中心点取为当前cluster中所有数据点的平均值, ...

  9. MySQL 使用profile分析慢sql,group left join效率高于子查询

    MySQL 使用profile分析慢sql,group left join效率高于子查询 http://blog.csdn.net/mchdba/article/details/54380221 -- ...

  10. 代码编辑器之sublime text

    http://www.iplaysoft.com/sublimetext.html 1.特点: 中文乱码问题:另外,很多朋友反映表示打开中文会有乱码,其实是因为ST2本身只支持UTF-8编码,而我们常 ...