环境
系统: centos7.7
docker: 19
mysql: 8.0.18
将原网址变更为
报错分析
日志内容
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
问题分析
看到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个)
在/etc/sysctl.conf
fs.aio-max-nr=262144 #(256k个)
执行命令使其生效
sysctl -p
可以看到/proc/sys/fs/aio-max-nr中的值发生了变化
cat /proc/sys/fs/aio-max-nr
重启MySQL实例