大浪淘沙2023 2014-04-30 02:13
浏览 1641

紧急求助:生产环境,mysql双主结构,备机同步DDL语句成功,但是同步DML语句失败

问题描述:双主架构环境,最近在主机上执行DDL语句能成功同步到备机,但是在主机上执行DML语句失败,请各位帮忙看一下,谢谢!
Linux版本:
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
mysql版本
+----------------------------+
| @@version |
+----------------------------+
| 5.1.59 |
+----------------------------+

主机:192.168.0.100
备机:192.168.0.101
操作过程:
(1)在101上执行flush logs;
(2)在100上执行如下sql语句:
create table ttt(a int, b varchar(10));
insert into ttt values(1,'wxc'),(2,'wyh'),(3,'byq');
(3)在101上查看ttt的数据,结构只存在表结构,但是表中没有数据;
(4)查看101上的relaylog日志,发现如下信息:
11101 # at 102837
11102 #140430 9:52:10 server id 9 end_log_pos 97358117 Query thread_id=1498768873 exec_time=0 error_code=0
11103 use mgr/*!*/;
11104 SET TIMESTAMP=1398822730/*!*/;
11105 create table ttt(a int, b varchar(10))
11106 /*!*/;

11170 # at 103496
11171 # at 103540
11172 #140430 9:52:10 server id 9 end_log_pos 97358715 Table_map: mgr.ttt mapped to number 5791859673
11173 #140430 9:52:10 server id 9 end_log_pos 97358771 Write_rows: table id 5791859673 flags: STMT_END_F
11174
11175 BINLOG '
11176 SldgUxMJAAAALAAAAHuTzQUAANnDOFkBAAEAA21ncgADdHR0AAIDDwIeAAM=
11177 SldgUxcJAAAAOAAAALOTzQUAANnDOFkBAAEAAv/8AQAAAAN3eGP8AgAAAAN3eWj8AwAAAANieXE=
11178 '/*!*/;
11179 ### INSERT INTO mgr.ttt
11180 ### SET
11181 ### @1=1
11182 ### @2='wxc'
11183 ### INSERT INTO mgr.ttt
11184 ### SET
11185 ### @1=2
11186 ### @2='wyh'
11187 ### INSERT INTO mgr.ttt
11188 ### SET
11189 ### @1=3
11190 ### @2='byq'

从上面看,明显能看到ddl和dml语句的存在。

(5)在101上查看binlog日志中与ttt相关的内容,内容如下:
11042 # at 100405
11043 #140430 9:52:10 server id 9 end_log_pos 100510 Query thread_id=1498768873 exec_time=0 error_code=0
11044 use mgr/*!*/;
11045 SET TIMESTAMP=1398822730/*!*/;
11046 create table ttt(a int, b varchar(10))
11047 /*!*/;
但是没有发现任何插入表ttt相关的insert语句。

(6)查看了一下双主的slave状态,状态一切均正常,如下:
100状态如下:
admin@localhost : test 10:02:47> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.0.101
Master_User: coolcloud
Master_Port: 3307
Connect_Retry: 60
Master_Log_File: mysql-bin.000375
Read_Master_Log_Pos: 3053614
Relay_Log_File: mysql-relay-bin.000774
Relay_Log_Pos: 251
Relay_Master_Log_File: mysql-bin.000375
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 3053614
Relay_Log_Space: 449
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: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:

101状态如下:
admin@localhost : test 09:57:12> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.0.100
Master_User: coolcloud
Master_Port: 3307
Connect_Retry: 60
Master_Log_File: mysql-bin.000393
Read_Master_Log_Pos: 98301418
Relay_Log_File: mysql-relay-bin.001058
Relay_Log_Pos: 925373
Relay_Master_Log_File: mysql-bin.000393
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 98301418
Relay_Log_Space: 1046500
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: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:

请各位大拿帮忙看一下什么原因。
对了,忘记补充一个现象,从101的数据是能同步到100上的。

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 seatunnel-web使用SQL组件时候后台报错,无法找到表格
    • ¥15 fpga自动售货机数码管(相关搜索:数字时钟)
    • ¥15 用前端向数据库插入数据,通过debug发现数据能走到后端,但是放行之后就会提示错误
    • ¥30 3天&7天&&15天&销量如何统计同一行
    • ¥30 帮我写一段可以读取LD2450数据并计算距离的Arduino代码
    • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
    • ¥15 vs2019中数据导出问题
    • ¥20 云服务Linux系统TCP-MSS值修改?
    • ¥20 关于#单片机#的问题:项目:使用模拟iic与ov2640通讯环境:F407问题:读取的ID号总是0xff,自己调了调发现在读从机数据时,SDA线上并未有信号变化(语言-c语言)
    • ¥20 怎么在stm32门禁成品上增加查询记录功能