mysql主从同步如何跳过错误


当前第2页 返回上一页

在master上执行以下语句:

1

2

3

4

mysql>use mysql;

mysql>create table t1 (id int);

mysql>use mydb;

mysql>insert into mysql.t1 select 1;

在slave上查看复制状态

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

mysql> show slave status\G

*************************** 1. row ***************************

               Slave_IO_State: Waiting for master to send event

                  Master_Host: 192.168.247.128

                  Master_User: repl

                  Master_Port: 3306

                Connect_Retry: 60

              Master_Log_File: mysql-bin.000017

          Read_Master_Log_Pos: 2341

               Relay_Log_File: DBtest1-relay-bin.000011

                Relay_Log_Pos: 494

        Relay_Master_Log_File: mysql-bin.000017

             Slave_IO_Running: Yes

            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: 1146

                   Last_Error: Error 'Table 'mysql.t1' doesn't exist' on query. Default database: 'mydb'. Query: 'insert into mysql.t1 select 1'

                 Skip_Counter: 0

          Exec_Master_Log_Pos: 1919

              Relay_Log_Space: 1254

              Until_Condition: None

               Until_Log_File:

                Until_Log_Pos: 0

           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: 0

                Last_IO_Error:

               Last_SQL_Errno: 1146

               Last_SQL_Error: Error 'Table 'mysql.t1' doesn't exist' on query. Default database: 'mydb'. Query: 'insert into mysql.t1 select 1'

  Replicate_Ignore_Server_Ids:

             Master_Server_Id: 1

                  Master_UUID: f0f7faf6-51a8-11e3-9759-000c29eed3ea

             Master_Info_File: /var/lib/mysql/master.info

                    SQL_Delay: 0

          SQL_Remaining_Delay: NULL

      Slave_SQL_Running_State:

           Master_Retry_Count: 86400

                  Master_Bind:

      Last_IO_Error_Timestamp:

     Last_SQL_Error_Timestamp: 131210 21:37:19

               Master_SSL_Crl:

           Master_SSL_Crlpath:

           Retrieved_Gtid_Set:

            Executed_Gtid_Set:

                Auto_Position: 0

1 row in set (0.00 sec)

由结果可以看到,Read_Master_Log_Pos: 2341,Exec_Master_Log_Pos: 1919时出错了Last_SQL_Error: Error 'Table 'mysql.t1' doesn't exist' on query.

因为只对mydb记录了binlog,当在mydb库操作其它数据库的表,但该表在slave上又不存在时就出错了。

以上就是mysql主从同步如何跳过错误的详细内容,更多文章请关注木庄网络博客

返回前面的内容

相关阅读 >>

分布式事务的图文详解

命令行怎么设置mysql编码格式?

mysql查看数据库命令是什么?

掌握mysql隐藏字段(rowid)什么时候是可见的

mysql的索引和事务详细解读

mysql分区之hash分区详解

mysql中使用binlog时binlog格式的选择

mysql数据库事务transaction示例讲解教程

如何在控制台修改mysql字符集

mysql数据存放的位置在哪

更多相关阅读请进入《mysql》频道 >>


数据库系统概念 第6版
书籍

数据库系统概念 第6版

机械工业出版社

本书主要讲述了数据模型、基于对象的数据库和XML、数据存储和查询、事务管理、体系结构等方面的内容。



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...