欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 运维知识 > 数据库 >内容正文

数据库

MySQL Replication Error 处理一例

发布时间:2025/3/15 数据库 46 豆豆
生活随笔 收集整理的这篇文章主要介绍了 MySQL Replication Error 处理一例 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

故障现象

MySQL slave status详情

mysql> show slave status\G *************************** 1. row ***************************Slave_IO_State: Waiting for master to send eventMaster_Host: 10.10.10.101Master_User: rootMaster_Port: 3306Connect_Retry: 60Master_Log_File: mysql-bin.000010Read_Master_Log_Pos: 143861468Relay_Log_File: slave-relay-bin.000525Relay_Log_Pos: 128835579Relay_Master_Log_File: mysql-bin.000010Slave_IO_Running: YesSlave_SQL_Running: NoReplicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: mysql.%,information_schema.%,test.%Last_Errno: 0Last_Error: Could not parse relay log event entry. The possck this by running 'mysqlbinlog' on the binary log), the slave's relay log iay log), a network problem, or a bug in the master's or slave's MySQL code. you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this Skip_Counter: 0Exec_Master_Log_Pos: 128835442Relay_Log_Space: 143862393Until_Condition: NoneUntil_Log_File: Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: NULL 1 row in set (0.00 sec)mysql>

 

MySQL 错误日志中显示了问题的根源,磁盘空间满.

thatsit-mysql:/var/lib/mysql # grep -i disk mysqld.log-20160114 /usr/sbin/mysqld: Disk is full writing './mysql-bin.000319' (Errcode: 28). Waiting for someone to free space... (Expect up to 60 secs delay for server to continue after freeing disk space) /usr/sbin/mysqld: Disk is full writing './mysql-bin.000320' (Errcode: 28). Waiting for someone to free space... (Expect up to 60 secs delay for server to continue after freeing disk space) thatsit-mysql:/var/lib/mysql #

MySQL 错误日志中同样还记录了binlog执行截至的位置点.

thatsit-mysql:/var/lib/mysql # grep ERROR mysqld.log-20160114|grep stopped|tail -1 160114 13:16:16 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'mysql-bin.000010' position 128835442 thatsit-mysql:/var/lib/mysql #

修复

① 清理MySQL datadir所在的磁盘

② 恢复MySQL SLAVE (STOP SLAVE → CHANGE MASTER → START SLAVE)

※: 位置点为上面从SLAVE STATUS的"Exec_Master_Log_Pos"或者错误日志中获取的.

mysql> stop slave; Query OK, 0 rows affected (0.00 sec)mysql> mysql> CHANGE MASTER TO-> MASTER_HOST='10.10.10.101',-> MASTER_PORT=3306,-> MASTER_USER='REP_USER',-> MASTER_PASSWORD='REP_PASSWORD',-> MASTER_LOG_FILE='mysql-bin.000010',-> MASTER_LOG_POS=128835442; Query OK, 0 rows affected (0.41 sec)mysql> start slave; Query OK, 0 rows affected (0.00 sec)

mysql>

操作后状态确认

mysql> show slave status\G *************************** 1. row ***************************Slave_IO_State: Waiting for master to send eventMaster_Host: 10.10.10.101Master_User: rootMaster_Port: 3306Connect_Retry: 60Master_Log_File: mysql-bin.000010Read_Master_Log_Pos: 144444705Relay_Log_File: slave-relay-bin.000002Relay_Log_Pos: 38259Relay_Master_Log_File: mysql-bin.000010Slave_IO_Running: YesSlave_SQL_Running: YesReplicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: mysql.%,information_schema.%,test.%Last_Errno: 0Last_Error: Skip_Counter: 0Exec_Master_Log_Pos: 128873466Relay_Log_Space: 15609498Until_Condition: NoneUntil_Log_File: Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: 99299 1 row in set (0.00 sec)mysql>

 

此故障至此修复完毕.

 

转载于:https://www.cnblogs.com/thatsit/p/5133140.html

总结

以上是生活随笔为你收集整理的MySQL Replication Error 处理一例的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。