3.2.7. 故障排除
本节描述了您可能会遇到的问题,并给出可能的解决方案。
3.2.7.1. Linux Native AIO 失败 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
症状
MySQL 容器无法启动,日志显示类似如下:
151113 5:06:56 InnoDB: Using Linux native AIO
151113 5:06:56 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.
Waiting for MySQL to start ...
InnoDB: Warning: io_setup() attempt 3 failed.
InnoDB: Warning: io_setup() attempt 4 failed.
Waiting for MySQL to start ...
InnoDB: Warning: io_setup() attempt 5 failed.
151113 5:06:59 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
151113 5:06:59 InnoDB: Fatal error: cannot initialize AIO sub-system
151113 5:06:59 [ERROR] Plugin 'InnoDB' init function returned error.
151113 5:06:59 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
151113 5:06:59 [ERROR] Unknown/unsupported storage engine: InnoDB
151113 5:06:59 [ERROR] Aborting
解释
MySQL 的存储引擎因为资源限制而无法使用内核的 AIO(异步 I/O)功能。
解决方案
通过将环境变量 MYSQL_AIO 设置为 0 来完全关闭 AIO 的使用。在后续的部署中,这会让 MySQL 配置变量 innodb_use_native_aio 的值为 0。
另外,还可增加 aio-max-nr 内核资源。下面的例子检查了 aio-max-nr 的当前值并加倍。
$ sysctl fs.aio-max-nr
fs.aio-max-nr = 1048576
# sysctl -w fs.aio-max-nr=2097152
这会针对每个节点进行解析,持续到下一个节点重启为止。