Replication Problems
Troubleshooting MySQL/MariaDB replication issues.
IO Thread Stopped
Symptoms: "Slave_IO_Running: No" in replication status.
Common Causes:
- Master hostname changed
- Network connectivity issues
- Master MySQL not running
- Authentication failed
Solutions:
# On slave, check error:
mysql -e "SHOW SLAVE STATUS\G" | grep Last_IO_Error
# If hostname changed, update master info:
mysql -e "STOP SLAVE; CHANGE MASTER TO MASTER_HOST='new-hostname'; START SLAVE;"
SQL Thread Stopped
Symptoms: "Slave_SQL_Running: No" in replication status.
Common Causes:
- Duplicate key error
- Schema mismatch
- Disk full
Solutions:
# Check error:
mysql -e "SHOW SLAVE STATUS\G" | grep Last_SQL_Error
# Skip one error (use cautiously):
mysql -e "STOP SLAVE; SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; START SLAVE;"
High Replication Lag
Symptoms: Seconds_Behind_Master growing continuously.
Common Causes:
- Slave server overloaded
- Slow queries on master
- Network bandwidth issues
Solutions:
- Check slave CPU/memory usage
- Identify slow queries:
SHOW PROCESSLIST; - Consider upgrading slave hardware