Chinaunix

标题: 【讨论中】环状SQL同步问题 [打印本页]

作者: liyaoxinchifan    时间: 2013-10-09 16:53
标题: 【讨论中】环状SQL同步问题
本帖最后由 chinafenghao 于 2013-10-11 12:32 编辑

有三台服务器A B C,需要配置为:B主A从、C主B从、A主C从,组成环状,当修改ABC中任意一台的数据库时其他两台同步,但是当我配置完后发现,在其中一台的数据库中增加一个表时,只有一台同步,另一台没有反应,比如在A添加表时,B没有反应,C同步成功,但是show slave status\G显示的状态都正常,原因找了一下午也没找出来,求大神解惑!谢谢!
A:的状态
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 10.0.3.121
                  Master_User: atb
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: log-slave-updates.000002
          Read_Master_Log_Pos: 282
               Relay_Log_File: relay-bin.000002
                Relay_Log_Pos: 435
        Relay_Master_Log_File: log-slave-updates.000002
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: test
          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: 282
              Relay_Log_Space: 584
              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:
1 row in set (0.00 sec)

B的状态:
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 10.0.3.125
                  Master_User: btc
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: log-slave-updates.000002
          Read_Master_Log_Pos: 106
               Relay_Log_File: relay-bin.000002
                Relay_Log_Pos: 259
        Relay_Master_Log_File: log-slave-updates.000002
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: test
          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: 106
              Relay_Log_Space: 408
              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:
1 row in set (0.00 sec)

C的状态:
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 10.0.3.117
                  Master_User: cta
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: log-slave-updates.000002
          Read_Master_Log_Pos: 189
               Relay_Log_File: relay-bin.000002
                Relay_Log_Pos: 342
        Relay_Master_Log_File: log-slave-updates.000002
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: test
          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: 189
              Relay_Log_Space: 491
              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:
1 row in set (0.00 sec)

ABC中my.cnf文件(只贴了A的,除了severid不一样其他的都一样):
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
server-id=1
replicate-do-db=test
log-bin=log-slave-updates
log-slave-updates = on
binlog-ignore-db=mysql
auto_increment_offset = 1
auto_increment_increment = 2
relay-log=relay-bin

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
作者: chinafenghao    时间: 2013-10-11 12:32
@liyaoxinchifan
没做过闭环的,不清楚原因。
作者: liyaoxinchifan    时间: 2013-10-11 12:46
回复 2# chinafenghao


    终于搞明白了,配置文件中log-slave-updates = on应该写为log-slave-updates




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2