I set up a replica between two MySQL servers. After my initial setup, the replication worked without any problem, but now they are out of sync.
On Master I can see:
Variable Valor
File mysql-bin.000200
Position 93069547
Binlog_Do_DB
Binlog_Ignore_DB
And:
ID del servidor Servidor
1670759689
On the Slave:
Variable Valor
Slave_IO_State Queueing source event to the relay log
Master_Host IP_ADDRESS_FROM_MY_MASTER
Master_User c44b0fbab37cf3
Master_Port 3306
Connect_Retry 60
Master_Log_File mysql-bin.000006
Read_Master_Log_Pos 8759143
Relay_Log_File ns328448-relay-bin.000003
Relay_Log_Pos 67837
Relay_Master_Log_File mysql-bin.000006
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 67621
Relay_Log_Space 8759800
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 2606688
After a reboot on the slave, it seems the server is catching up with the pending files.
- What can be done to prevent this "out of sync" to happen?
- How can I investigate what caused the system to get stucked?
- I see all the log files are stored on the server, how can I set a max number of files to be kept?
Thanks, Javi
-- EDIT --
Today the status for servers are: Master
Variable Valor
File mysql-bin.000209
Position 61419650
...
Slave
Variable Valor
Slave_IO_State Waiting for source to send event
...
Master_Log_File mysql-bin.000209
Read_Master_Log_Pos 62149115
Relay_Log_File ns328448-relay-bin.000016
Relay_Log_Pos 42109202
Relay_Master_Log_File mysql-bin.000011
Slave_IO_Running Yes
Slave_SQL_Running Yes
...
Exec_Master_Log_Pos 42108986
Relay_Log_Space 19138941381
...
Seconds_Behind_Master 2528578
It catch my attention that in both cases, "Master_Log_File" points to the same file and "Read_Master_Log_Pos" (almost) to the same position.
"Seconds_Behind_Master" has not changed much.
If I restart the Slave server, and check its status again, it has "magically" changed to:
Slave_IO_State Queueing source event to the relay log
...
Master_Log_File mysql-bin.000008
Read_Master_Log_Pos 3812616
Relay_Log_File ns328448-relay-bin.000003
Relay_Log_Pos 6100
Relay_Master_Log_File mysql-bin.000008
Slave_IO_Running Yes
Slave_SQL_Running Yes
...
Exec_Master_Log_Pos 5884
Relay_Log_Space 3813225
...
Seconds_Behind_Master 2626954
And now "Master_Log_File" and "Read_Master_Log_Pos" point to a different place.
Does this help?