網站首頁 編程語言 正文
? ? ? ? 在接收到某境外業務項目同步國內分析庫實例的MySQL中轉從庫磁盤大于80%的告警,ECS主機數據盤擴容過程中,偶然發現從庫sql_thread線程狀態中斷。其中查閱主庫的error log無異常,本想通過mysqlbinlog?--base64-output=decode-rows -vv(verify-binlog-checksum) 是否可以正常解析binlog文件,以驗證主庫的binlog是否損壞,發現主庫binlog已經過期刪除。此外,在處理從庫的時候重啟從庫MySQL實例,因為relay_log_recovery=on設置導致從庫的relay-log也因重啟實例被刪除了,當前就只能寄希望于從庫實例上的蛛絲馬跡看是否能跟蹤定位發現問題,從庫實例主機日志也被清理了,其中MySQL錯誤日志如下:
##從庫MySQL錯誤日志如下:
Status information:
Current dir: /data/3306/data/
Running threads: 12 Stack size: 262144
Current locks:
lock: 0x7c673b0:
lock: 0x7bf5a60:
lock: 0x7bd8770:
lock: 0x7be74b0:
lock: 0x7bc6350:
lock: 0x7bbf920:
lock: 0x7bb7c10:
lock: 0x2081480:
lock: 0x20813a0:
lock: 0x20812c0:
......
Events status:
LLA = Last Locked At LUA = Last Unlocked At
WOC = Waiting On Condition DL = Data Locked
Event scheduler status:
State : INITIALIZED
Thread id : 0
LLA : n/a:0
LUA : n/a:0
WOC : NO
Workers : 0
Executed : 0
Data locked: NO
Event queue status:
Element count : 0
Data locked : NO
Attempting lock : NO
LLA : init_queue:103
LUA : init_queue:111
WOC : NO
Next activation : never
2022-09-01T11:41:22.841046+08:00 7 [ERROR] Error in Log_event::read_log_event(): 'Found invalid event in binary log', data_len: 59, event_type: 101
2022-09-01T11:41:22.841075+08:00 7 [ERROR] Error reading relay log event for channel '': slave SQL thread aborted because of I/O error
2022-09-01T11:41:22.841091+08:00 7 [ERROR] Slave SQL for channel '': Relay log read failure: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog
' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or sl
ave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave. Error_code: 1594
2022-09-01T11:41:22.843607+08:00 7 [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.000242' position 314110116.
2022-09-01T22:09:25.948621+08:00 2 [Note] Aborted connection 2 to db: 'unconnected' user: 'dm_cnl' host: '10.10.80.99' (Got timeout reading communication packets)
? ? ? ? 從以上從庫實例MySQL錯誤日志,大概能猜測可能已經跨境網絡導致從庫實例接收到的Relay-log傳輸過程中錯誤導致日志文件損壞,進而導致MySQL從庫實例在回放binlog時報錯,即sql_thread_running=no,但在定位和解決問題的幾點教訓總結如下:
- 在定位和解決問題之前,"保護現場"!即不管是數據還是日志都需要足夠警惕,事先備份
- 重要數據保護措施/參數等:
- relay_log_recovery?
- expire_logs_days
- /var/log/messags
- /data/3306/log/error.log?
- 任何時候,任何服務都應及時配置/創建服務的重要監控告警項,以及時發現和解決問題
- 解決relay-log文件損壞的重要步驟
- 定位是主庫binlog還是從庫relaylog損壞,通過mysqlbinlog看是否正常解析日志文件
- 查閱主從操作系統日志和MySQL錯誤日志信息,/var/log/messages? error.log?
- 如master節點的binlog還保留著,從節點執行reset slave,change master to重新同步
- 如master節點的binlog已過期刪除,重新備份主庫數據并重做主從數據同步
- MySQL對于binlog和relaylog文件中event事件有效性校驗參數
參數名稱 | 參數解釋 |
binlog_checksum | binlog完整性校驗參數,默認CRC32,如為none,檢查binlog中event的長度方式來校驗 |
master_verify_checksum? | 從Master中獲取binlog會去校驗binlog的事件完整性,兩種情況會發生,其一:show binlog events,其二:binlog dump向slave中binlog |
slave_sql_verify_checksum | 從庫sql_thread回放relaylog獲取event時校驗 |
原文鏈接:https://blog.csdn.net/u014674448/article/details/126833588
- 上一篇:TCP/IP協議類比生活案例
- 下一篇:Linux中數據傳輸命令scp/rsync
相關推薦
- 2022-03-15 在MacOS+Linux+Nginx中發布和部署Asp.Net?Core_自學過程
- 2022-04-11 C#基于SerialPort類實現串口通訊詳解_C#教程
- 2022-11-02 react組件中過渡動畫的問題解決_React
- 2022-05-26 為Jenkins創建定時構建任務_相關技巧
- 2022-06-01 解決IIS不識別PUT和DELETE請求_win服務器
- 2022-07-20 SQL?Server中搜索特定的對象_MsSql
- 2022-07-21 C語言運算符深入探究優先級與結合性及種類_C 語言
- 2022-09-25 解決ERROR in Conflict: Multiple assets emit differen
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支