好湿?好紧?好多水好爽自慰,久久久噜久噜久久综合,成人做爰A片免费看黄冈,机机对机机30分钟无遮挡

主頁 > 知識庫 > 磁盤寫滿導致MySQL復制失敗的解決方案

磁盤寫滿導致MySQL復制失敗的解決方案

熱門標簽:呂梁外呼系統 南太平洋地圖標注 html地圖標注并導航 大豐地圖標注app 400電話變更申請 北京金倫外呼系統 催天下外呼系統 400電話辦理服務價格最實惠 武漢電銷機器人電話

案例場景

      今天在線上發現一個問題,由于監控沒有覆蓋到,某臺機器的磁盤被寫滿了,導致線上MySQL主從復制出現問題。問題如下:

localhost.(none)>show slave status\G
*************************** 1. row ***************************
               Slave_IO_State:
                  Master_Host: 10.xx.xx.xx
                  Master_User: replica
                  Master_Port: 5511
                Connect_Retry: 60
              Master_Log_File:
          Read_Master_Log_Pos: 4
               Relay_Log_File: relay-bin.001605
                Relay_Log_Pos: 9489761
        Relay_Master_Log_File:
             Slave_IO_Running: No
            Slave_SQL_Running: No
                   Last_Errno: 13121
                   Last_Error: 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, the server was unable to fetch a
 keyring key required to open an encrypted relay log file, or a bug in the master's or 
slave's MySQL code. If you want to check the master's binary log or slave's relay log, 
you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave.

于是查看error log,發現error log中的內容如下:

2021-03-31T11:34:39.367173+08:00 11 [Warning] [MY-010897] [Repl] Storing MySQL user name or 
password information in the master info repository is not secure and is therefore not 
recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; 
see the 'START SLAVE Syntax' in the MySQL Manual for more information.

2021-03-31T11:34:39.368161+08:00 12 [ERROR] [MY-010596] [Repl] Error reading relay log 
event for channel '': binlog truncated in the middle of event; consider out of disk space

2021-03-31T11:34:39.368191+08:00 12 [ERROR] [MY-013121] [Repl] 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, the server was unable to fetch a keyring key required to open an encrypted
 relay log file, or a bug in the master's or slave's MySQL code. If you want to check the 
master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW
 SLAVE STATUS' on this slave. Error_code: MY-013121

2021-03-31T11:34:39.368205+08:00 12 [ERROR] [MY-010586] [Repl] 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.000446' position 9489626

從描述中可以看到,error log是比較智能的,發現了磁盤問題,并提示我們需要"consider out of disk space"

解決問題

      登錄服務器,很快就發現是MySQL所在的服務器磁盤使用率達到100%了,問題原因跟error log中的內容一致。

      現在就解決這個問題。基本的思路就是清理磁盤文件,然后重新搭建復制關系,這個過程似乎比較簡單,但是實際操作中,在搭建復制關系的時候出現了下面的報錯:

### 基于gtid的復制,想重新搭建復制關系
localhost.(none)>reset slave;
ERROR 1371 (HY000): Failed purging old relay logs: Failed during log reset

localhost.(none)>reset slave all;
ERROR 1371 (HY000): Failed purging old relay logs: Failed during log reset

第一步:因為復制是基于gtid進行的,所以直接記錄show slave status的狀態后,就可以重新reset slave,并利用change master語句來重建復制關系了。

但是卻出現上面的報錯,從報錯信息看是mysql無法完成purge relay log的操作,這看起來不科學。好吧,既然你自己不能完成purge relay logs的操作,那就讓我來幫你吧。

第二步:手工rm -f 刪除所有的relay log,發現報錯變成了:

localhost.(none)>reset slave all;
ERROR 1374 (HY000): I/O error reading log index file

嗯,好吧,問題沒有得到解決。

然后思考了下,既然不能通過手工reset slave 來清理relay log,直接stop

slave 然后change master行不行呢?

第三步:直接stop slave,然后change master,不執行reset slave all的語句,結果如下:

localhost.(none)>change master to master_host='10.13.224.31',
    -> master_user='replica',
    -> master_password='eHnNCaQE3ND',
    -> master_port=5510,
    -> master_auto_position=1;
ERROR 1371 (HY000): Failed purging old relay logs: Failed during log reset

得,問題依舊。

第四步:反正復制已經報錯斷開了,執行個start slave看看,結果戲劇性的一幕出現了:

localhost.(none)>start slave;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    262
Current database: *** NONE ***


Query OK, 0 rows affected (0.01 sec)


localhost.(none)>
[root@ ~]#

執行start slave之后,實例直接掛了。

到這里,復制徹底斷開了,從庫實例已經掛了。

第五步:看看實例還能不能重啟,嘗試重啟實例,發現實例還能起來。實例重新起來后,查看復制關系,結果如下:

localhost.(none)>show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: Queueing master event to the relay log
                  Master_Host: 10.xx.xx.xx
                  Master_User: replica
                  Master_Port: 5511
                Connect_Retry: 60
              Master_Log_File: 
          Read_Master_Log_Pos: 4
               Relay_Log_File: relay-bin.001605
                Relay_Log_Pos: 9489761
        Relay_Master_Log_File:
             Slave_IO_Running: Yes
            Slave_SQL_Running: No
                   Last_Errno: 13121
                   Last_Error: 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, the server was unable to fetch a 
keyring key required to open an encrypted relay log file, or a bug in the master's or slave's 
MySQL code. If you want to check the master's binary log or slave's relay log, you will be able 
to know their names by issuing 'SHOW SLAVE STATUS' on this slave.
                 Skip_Counter: 0

復制關系依舊報錯。

第六步:重新reset slave all看看,結果成功了。

localhost.(none)>stop slave;
Query OK, 0 rows affected (0.00 sec)


localhost.(none)>reset slave all;
Query OK, 0 rows affected (0.03 sec)

第七步:重新搭建復制關系并啟動復制

localhost.(none)>change master to master_host='10.xx.xx.xx',
    -> master_user='replica',
    -> master_password='xxxxx',
    -> master_port=5511,
    -> master_auto_position=1;
Query OK, 0 rows affected, 2 warnings (0.01 sec)


localhost.(none)>start slave;
Query OK, 0 rows affected (0.00 sec)


localhost.(none)>show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 10.xx.xx.xx
                  Master_User: replica
                  Master_Port: 5511
                Connect_Retry: 60
                          ...
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes

發現實例的復制關系可以建立起來了。

一點總結

    當磁盤寫滿的情況發生之后,mysql服務無法向元信息表中寫數據,relay log也可能已經不完整了,如果直接清理了服務器上的磁盤數據,再去重新change master修改主從復制關系,可能會出現報錯,不能直接修復,因為這不是一個正常的主從復制關系斷裂場景。

   所以,正確的做法應該是:

1、清理服務器的磁盤

2、重啟復制關系斷開的那個從庫

3、重新reset slave all、change master來搭建主從復制關系即可

   如果有更好的方法,還請不吝賜教。

以上就是磁盤寫滿導致MySQL復制失敗的解決方案的詳細內容,更多關于MySQL復制失敗的解決方案的資料請關注腳本之家其它相關文章!

您可能感興趣的文章:
  • MySql主從復制機制全面解析
  • Mysql主從復制與讀寫分離圖文詳解
  • MySQL 復制表的方法
  • MySQL 8.0.23中復制架構從節點自動故障轉移的問題
  • MYSQL數據庫GTID實現主從復制實現(超級方便)
  • MySql主從復制實現原理及配置
  • 淺析MySQL的WriteSet并行復制
  • MySQL主從復制原理以及需要注意的地方
  • mysql 如何動態修改復制過濾器
  • 淺析MySQL并行復制
  • MySQL復制問題的三個參數分析

標簽:西寧 南充 無錫 迪慶 自貢 龍巖 麗水 徐州

巨人網絡通訊聲明:本文標題《磁盤寫滿導致MySQL復制失敗的解決方案》,本文關鍵詞  磁盤,寫滿,導致,MySQL,復制,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《磁盤寫滿導致MySQL復制失敗的解決方案》相關的同類信息!
  • 本頁收集關于磁盤寫滿導致MySQL復制失敗的解決方案的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 欧美人禽猛交狂配视频| 亚洲AV无码区国产乱码99果冻| 男生干女生软件| 男女互添下身出水视频| 国产做受???高潮电影| 亚洲欧洲精品suv| 黄色免费软件| 波多野结衣视频毛片 | 色成网| 日本三级网站在线线观看| 国产福利一区二区三区视频| 一本大道道香蕉a又又又| 国产成综合| 国产无套粉嫩白浆在线精品| 吃奶摸下激烈视频AV国产精品| A级毛片在线看| 色www亚洲| 秋霞网韩国理伦片不卡免费看| 男生鸡鸡对女生鸡鸡| 男人把女人强吻扒衣服| 日韩在线不卡一区在线观看| 国产视频色| 野外妓女B???BXXX| 国产黄网| 吃奶摸下的视频| 甜美的咬痕| 免费观看男人免费桶女人视频| 欧美同性又粗又硬gV| 夜夜操女人| 女色窝人体色77777| 精品国产乱码一区二区三区APP| 亚洲精品无码一区二区三区久久久 | 娇妻屁股眼被开发1-8| 一级α爰做片免费观看| 国产精品视频人人做人人| 草莓视频404| 久久99精品国产91久久来源 | 香蕉一级视频| japanesexxxxfreesextv| 韩国AV无码片在线观看| Chinese男男Gay FuCK激情|