日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

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

数据库

MySQL—异常处理

發布時間:2025/7/14 数据库 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 MySQL—异常处理 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

今天在一臺測試服務器發現異常,開發人員發來一條sql語句發現無法執行,一直處于等待過程中,sql語句如下:

1 delete from live.* where _id = 'xxxxx'

登錄服務器,連接mysql發現登錄不上

查看錯誤日志,報錯如下:

1 2019-01-07T02:12:40.663747Z 61131 [ERROR] InnoDB: posix_fallocate(): Failed to preallocate data for file /data/mysql/3306/innodb/ibtmp1, desired size 67108864 bytes. Operating system error number 28. Check that the disk is not full or a disk quota exceeded. Make sure the file system supports this function. Some operating system error numbers are described at http://dev.mysql.com/doc/refman/5.7/en/ operating-system-error-codes.html 2 2019-01-07T02:12:41.120936Z 61131 [Warning] InnoDB: 1048576 bytes should have been written. Only 1032192 bytes written. Retrying for the remaining bytes. 3 2019-01-07T02:12:41.121006Z 61131 [Warning] InnoDB: Retry attempts for writing partial data failed. 4 2019-01-07T02:12:41.121023Z 61131 [ERROR] InnoDB: Write to file /data/mysql/3306/innodb/ibtmp1failed at offset 50735349760, 1048576 bytes should have been written, only 1032192 were written. Operating system error number 28. Check that your OS and file system support files of this size. Check also that the disk is not full or a disk quota exceeded. 5 2019-01-07T02:12:41.121056Z 61131 [ERROR] InnoDB: Error number 28 means 'No space left on device' 6 2019-01-07T02:12:41.121068Z 61131 [Note] InnoDB: Some operating system error numbers are described at http://dev.mysql.com/doc/refman/5.7/en/operating-system-error-codes.html 7 2019-01-07T02:12:41.121078Z 61131 [Warning] InnoDB: Error while writing 67108864 zeroes to /data/mysql/3306/innodb/ibtmp1 starting at offset 50679775232 8 2019-01-07T02:12:41.121129Z 61131 [ERROR] /usr/local/mysql/bin/mysqld: The table '/data/mysql/3306/tmp/#sql_61f8_5' is full 9 2019-01-07T02:12:41.137490Z 61133 [ERROR] InnoDB: posix_fallocate(): Failed to preallocate data for file /data/mysql/3306/innodb/ibtmp1, desired size 10502144 bytes. Operating system error number 28. Check that the disk is not full or a disk quota exceeded. Make sure the file system supports this function. Some operating system error numbers are described at http://dev.mysql.com/doc/refman/5.7/en/ operating-system-error-codes.html 10 2019-01-07T02:12:41.137706Z 61133 [Warning] InnoDB: Retry attempts for writing partial data failed. 11 2019-01-07T02:12:41.137722Z 61133 [Warning] InnoDB: Error while writing 10502144 zeroes to /data/mysql/3306/innodb/ibtmp1 starting at offset 50736381952 12 2019-01-07T02:12:41.137761Z 61133 [ERROR] /usr/local/mysql/bin/mysqld: The table '/data/mysql/3306/tmp/#sql_61f8_7' is full 13 2019-01-07T02:39:40.209105Z 61221 [ERROR] InnoDB: posix_fallocate(): Failed to preallocate data for file /data/mysql/3306/innodb/ibtmp1, desired [root


其中比較關鍵的這句:

1 /usr/local/mysql/bin/mysqld: The table '/data/mysql/3306/tmp/#sql_61f8_5' is full

檢查服務器磁盤使用情況,發現負載較高,

df -h命令發現磁盤100%使用率,ibtmp1文件占用49G

故障處理:

刪除了服務器上的一些日志文件,這時mysql可以登錄

運行 show processlist命令

發現有幾條sql處于等待狀態

正是這幾個sql導致的tmp文件暴增

sql語句如下:

desc (SELECTlam.anchor_id,lam.cus_id,lam.anchor_nick_name,lam.theme,lam.classification,lam.live_status,times,lam.l_group,lam.screencap,lam.l_record,lam.sort,cc.ol_number,lpd.pic_name,lpd.pic_path,lam.appllication_time,lam.start_broadcasting_time,lc.lc_name classificationName FROMlive.live_anchor_management lamLEFT JOIN live.live_picture_dict lpd ON lam.anchor_id = lpd.reference_idAND lpd.pic_property = 0LEFT JOIN customer cc ON lam.cus_id = cc.cus_idLEFT JOIN live.live_category lc ON lam.classification = lc.lc_id WHERElam.verify_status = 0AND lam.live_status = 1AND lam.sort = 1 ORDER BYlam.sticky_time DESCLIMIT 9999999999 ) UNIONDISTINCT ( SELECTlam.anchor_id,lam.cus_id,lam.anchor_nick_name,lam.theme,lam.classification,lam.live_status,times,lam.l_group,lam.screencap,lam.l_record,lam.sort,cc.ol_number,lpd.pic_name,lpd.pic_path,lam.appllication_time,lam.start_broadcasting_time,lc.lc_name classificationName FROMlive.live_anchor_management lamLEFT JOIN live.live_picture_dict lpd ON lam.anchor_id = lpd.reference_idAND lpd.pic_property = 0LEFT JOIN customer cc ON lam.cus_id = cc.cus_idLEFT JOIN live.live_category lc ON lam.classification = lc.lc_id WHEREverify_status = 0AND live_status = 1)

重啟數據庫服務

恢復正常

轉載于:https://www.cnblogs.com/ykyk1229/p/10233639.html

總結

以上是生活随笔為你收集整理的MySQL—异常处理的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。