2009年7月8日水曜日

[Mysql]Seconds_Behind_Master is sometimes increasing, and then set to null or zero again and again

Seconds_Behind_Master is sometimes increasing, and then set to null or zero again and again
  • References
  • Description
    The value of Seconds_Behind_Master means the "This field is an indication of how “late” the slave is" in replication slave database. This value is often increased when the synchronization process in slave database is slower than master database's state.
    But sometimes the value of the Sseconds_Behind_Master is increasing, after a few seconds the value of Sescond_Behind_Master is displayed as zero or null quickly and again and again. The value of Slave_IO_Running is sometimes displayed as "No" when the Second_Behind_Master is displayed as Null.
  • Cause
    When the server_id parameters between slave servers are duplicated, this problem is occured. The server_id value is unique identifier of the slave server.
    When some slave's server_id are duplicated, maybe master server recognize the same server, so one slave server is connecting and communicate with the the master server, other slave server is refused connecting to the master(at this time, slave's Slave_IO_Running status is set to Null because connection refused.)

    In our environment, this problem occures when one master database server has some slave servers, and some slave servers connects to the master database server and starts the replication at the same time. In this case, each slave server has to have the different server_id parameter when connecting to the master server.