iosetup mysql_InnoDB: Error: io_setup() failed with EAGAIN after 5 attempt
在一臺服務器中以各數據庫的備份文件為數據文件啟動多個MySQL實例供SQL Review使用。之前運行一直沒有問題(最多的時候有23個MyS
在一臺服務器中以各數據庫的備份文件為數據文件啟動多個MySQL實例供SQL Review使用。
之前運行一直沒有問題(最多的時候有23個MySQL實例同時運行),后來新配置了一臺服務器,啟動其對應的實例時失敗。
部分錯誤日志如下:
……
140505 16:05:59 InnoDB: Using Linux native AIO
140505 16:05:59 InnoDB: Warning: io_setup() failed with EAGAIN. Will make 5 attempts before giving up.
InnoDB: Warning: io_setup() attempt 1 failed.
InnoDB: Warning: io_setup() attempt 2 failed.
InnoDB: Warning: io_setup() attempt 3 failed.
InnoDB: Warning: io_setup() attempt 4 failed.
InnoDB: Warning: io_setup() attempt 5 failed.
140505 16:06:02 InnoDB: Error: io_setup() failed with EAGAIN after 5 attempts.
InnoDB: You can disable Linux Native AIO by setting innodb_use_native_aio = 0 in my.cnf
140505 16:06:02 InnoDB: Fatal error: cannot initialize AIO sub-system
140505 16:06:02 [ERROR] Plugin 'InnoDB' init function returned error.
140505 16:06:02 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140505 16:06:02 [ERROR] Unknown/unsupported storage engine: InnoDB
……
通過錯誤日志了解到最早發生錯誤的地方為 InnoDB: Error: io_setup() failed with EAGAIN after 5 attempts。
這個io_setup() failed with EAGAIN是關鍵。
我們man一下io_setup
NAME
io_setup - Create an asynchronous I/O context
……
DESCRIPTION
io_setup() creates an asynchronous I/O context capable of receiving at least maxevents. ctxp must not point to an AIO context that already exists, and must be
initialized to 0
prior to the call. On successful creation of the AIO context, *ctxp is filled in with the resulting handle.
RETURN VALUE
io_setup() returns 0 on success; otherwise, one of the errors listed in the "Errors" section is returned.
ERRORS
EINVAL ctxp is not initialized, or the specified maxevents exceeds internal limits. maxevents should be greater than 0.
EFAULT An invalid pointer is passed for ctxp.
ENOMEM Insufficient kernel resources are available.
EAGAIN The specified maxevents exceeds the user’s limit of available events.
ENOSYS io_setup() is not implemented on this architecture.
CONFORMING TO
……
看到io_setup用來創建異步I/O上下文環境用于特定目的,,錯誤代碼EAGAIN意為指定的maxevents 超出了用戶可用events的限制。
該服務器上已經運行了較多的MySQL實例,創建異步I/O的資源已經達到了臨界,所以新的實例啟動失敗。
最后通過在啟動MySQL實例時加入 --innodb_use_native_aio = 0解決了問題。
也有通過更改系統設置來解決此問題的(待驗證)。
cat /proc/sys/fs/aio-max-nr可以查看到當前的aio-max-nr的值一般為65536(64k個)
可通過下述步驟改變該文件中的值(上述文件不能直接編輯)
sudo vim /etc/sysctl.conf
修改或加入
fs.aio-max-nr=262144(256k個)
執行命令修改/proc/sys/fs/aio-max-nr
sysctl -p
可以看到/proc/sys/fs/aio-max-nr中的值發生了變化
cat /proc/sys/fs/aio-max-nr
重啟MySQL實例
還有通過修改mysql源碼來避免該問題的,但一般情況下不推薦也沒有必要這么做。
InnoDB存儲引擎的啟動、關閉與恢復
MySQL InnoDB獨立表空間的配置
MySQL Server 層和 InnoDB 引擎層 體系結構圖
InnoDB 死鎖案例解析
MySQL Innodb獨立表空間的配置
本文永久更新鏈接地址:
本文原創發布php中文網,轉載請注明出處,感謝您的尊重!
總結
以上是生活随笔為你收集整理的iosetup mysql_InnoDB: Error: io_setup() failed with EAGAIN after 5 attempt的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java中elements_Java中的
- 下一篇: CentOS 8 正式发布 基于Red