{{ item.name }}
{return false}">
{{ it.name }}
{{ it.text }}
MySQL 默认是启用 innodb_use_native_aio,使用异步 IO 操作,MySQL 启动时所需 aio slot 若超过系统当前 fs.aio-max-nr 设置,则无法启动报错 InnoDB: io_setup() failed with EAGAIN after 5 attempts.
通常在单机单实例环境下很少会遇到超出 aio-max-nr 的问题,若部署单机多实例,会大概率遇到此问题。我们来分析下该如何配置 fs.aio-max-nr 参数。关于 aio-nr 与 aio-max-nr
启动 MySQL 时会分配多少个 event slot?使用 strace 观测 io_setup 调用情况,
strace -fe trace=io_setup /path/to/mysqld --defaults-file=/etc/my.cnf --daemonize 2>&1 |grep io_setup
总共:4709 个 = 18 * 256 + 101
结论
实例申请的 fs.aio-nr = (innodb_read_io_threads + innodb_write_io_threads + log thread + insert buffer thread) * 256 + 101若单实例部署,fs.aio-max-nr 至少大于单实例 fs.aio-nr若多实例部署,至少大于 本机实例数 * 每个实例的 fs.aio-nr