MySQL 報錯及解決方案
在使用 MySQL 過程中,遇到了以下報錯:
2024-09-02T14:54:39.825067Z 0 [ERROR] InnoDB: Write to file ./ibtmp1 failed at offset 0, 1048576 bytes should have been
written, only 0 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.
2024-09-02T14:54:39.825085Z 0 [ERROR] InnoDB: Error number 28 means 'No space left on device'
2024-09-02T14:54:39.825089Z 0 [Note] InnoDB: Some operating system error numbers are described at http://dev.mysql.com
/doc/refman/5.7/en/operating-system-error-codes.html
2024-09-02T14:54:39.825093Z 0 [ERROR] InnoDB: Could not set the file size of './ibtmp1'. Probably out of disk space
2024-09-02T14:54:39.825096Z 0 [ERROR] InnoDB: Unable to create the shared innodb_temporary
2024-09-02T14:54:39.825103Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2024-09-02T14:54:40.227301Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2024-09-02T14:54:40.227319Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2024-09-02T14:54:40.227325Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2024-09-02T14:54:40.227331Z 0 [ERROR] Failed to initialize builtin plugins.
2024-09-02T14:54:40.227334Z 0 [ERROR] Aborting
問題原因
報錯信息顯示 No space left on device纫普,即磁盤空間不足。
解決步驟
1. 檢查磁盤占用情況
使用 du -sh * 命令查看磁盤占用情況:
du -sh *
2. 定位占用大量空間的文件
發(fā)現(xiàn) /var/lib/docker/overlay2/b10a9fb4ba3d950874b4bdecaa278fb8fb3524b14b532c78cd75f6c 文件占用了 49GB
3. 檢查 Docker 容器
查看 Docker 容器潭枣,發(fā)現(xiàn)該容器是用于 TTS(文本轉(zhuǎn)語音)任務(wù)筷厘,其中的日志文件占用了大量空間
4. 刪除日志文件
使用rm -f ,刪除容器中的日志文件
5. 重啟服務(wù)器和 MySQL 服務(wù)
重啟服務(wù)器
shutdown -r
總結(jié)
通過上述步驟前普,成功解決了磁盤空間不足的問題肚邢,并恢復(fù)了 MySQL 的正常運行。