Slave_IO_Running and Slave_SQL_Running is Yes but replication is not working
-
15-07-2021 - |
سؤال
I have setup a Master/Slave replicatio in two different servers with the exact same charachterisits. The MySQL version is 5.5 and the Slave connects to the Master through a VPN connection.
I have confiemd the replicatino is working, when I create a new database on the Master I can see the database exist in Slave. The problem is when I was doing some failure scenarios and shutdown the VPN, the replicaotin status on the Master didn't show any errors :
mysql> show slave status;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 10.0.0.2
Master_User: replication
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000001
Read_Master_Log_Pos: 52360
Relay_Log_File: mysql-relay-log.000004
Relay_Log_Pos: 441
Relay_Master_Log_File: mysql-bin.000001
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: 52360
Relay_Log_Space: 597
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:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
"""
As fars as I know if the Slave_IO_Running and Slave_SQL_Running is Yes this is an indication that the replication is working but this is not possible as there is no network connectivity between servers..
If I restart mysql in the slave then I will see a connection error and the replication status will be accurate, If I re-enable VPN without restarting the mysql on Slave it seems the replication will continue to work as normal if I create a new data base.
Can some one help ?
المحلول
Maybe you should take a look at this replication option http://dev.mysql.com/doc/refman/5.5/en/replication-options-slave.html#option_mysqld_slave-net-timeout