What I do when a replicated database slave's relay log partition has filled up
You have a replicated database but the slave’s relay log partition has filled up (probably because Ubuntu default partitioning has /var/log
in its own partition). You now have a broken slave with corrupt logs. What do you do?
- Move relay log file position (it’s the
relay-log
setting) inmy.cnf
and restart MySQL. - Open a MySQL root client (
# mysql -u root -p
) - Run
SHOW SLAVE STATUS\G
to get the currentExec_Master_Log_Pos
andMaster_Log_File
- Use
CHANGE MASTER TO
and set theMASTER_LOG_FILE
andMASTER_LOG_POS
to the settings from #3. - Run
START SLAVE;
to get things going again.
This works because of this piece of documentation:
CHANGE MASTER
deletes all relay log files and starts a new one, unless you specifyRELAY_LOG_FILE
orRELAY_LOG_POS
. In that case, relay logs are kept; therelay_log_purge
global variable is set silently to 0.
It’s not Ruby, but it is Rails; not everything in Rails is programming.