在一台server中以各数据库的备份文件为数据文件启动多个MySQL实例供SQL Review使用。

之前执行一直没有问题(最多的时候有23个MySQL实例同一时候执行)。后来新配置了一台server,启动其相应的实例时失败。



部分错误日志例如以下:

……

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的限制。

该server上已经执行了较多的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: Error: io_setup() failed with EAGAIN after 5 attempts的更多相关文章

  1. 【MySQL】InnoDB: Error: checksum mismatch in data file 报错

    参考:http://www.jb51.net/article/66951.htm 用5.7版本启动原5.5实例后,再用5.5启动出现以下报错 InnoDB: Error: checksum misma ...

  2. InnoDB: Error: log file .\ib_logfile0 is of different size 0 10485760 bytes

    启动WAMP Server的时候报例如以下的错误: 140618 23:12:32 [Note] Plugin 'FEDERATED' is disabled. 140618 23:12:32 Inn ...

  3. Error:Execution failed for task ':app:clean'.

    运行时出现 Error:Execution failed for task ':app:clean'. 错误,Builld->Clean Project即可.

  4. DBCC CHECKDB 遭遇Operating system error 112(failed to retrieve text for this error. Reason: 15105) encountered

    我们一个SQL Server服务器在执行YourSQLDBa的作业YourSQLDba_FullBackups_And_Maintenance时遇到了错误: Exec YourSQLDba.Maint ...

  5. Error:Execution failed for task ':app:transformClassesWithDexForDebug'.

    使用android studio 时,编译成功但用build apk时却报错 环境: android studio 1.5, jdk1.7 错误:Error:Execution failed for ...

  6. smtplib.SMTPAuthenticationError: (535, b'Error: authentication failed')解决办法

    raise SMTPAuthenticationError(code, resp) smtplib.SMTPAuthenticationError: (535, b'Error: authentica ...

  7. javaMail使用163邮箱报535 Error: authentication failed

    javaMail使用网易163邮箱或者是126或者是网易其他邮箱报535 Error: authentication failed javax.mail.AuthenticationFailedExc ...

  8. 使用git error: RPC failed; result=22, HTTP code = 411

    使用git提交比较大的文件的时候可能会出现这个错误 error: RPC failed; result=22, HTTP code = 411 fatal: The remote end hung u ...

  9. Android Studio 运行出现 Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.

    转载请标明出处: http://www.cnblogs.com/why168888/p/5978381.html 本文出自:[Edwin博客园] 我引用compile 'com.squareup.re ...

随机推荐

  1. ICPC-Beijing 2006 狼抓兔子

    题目描述 题解: 裸的最小割. 但是最大流跑不过去怎么办? 转变一下,既然最大流是一条左下<->右上的通路,我们可以把图划分为若干区域, 最后找左下到右上的最短路就行了. 代码: #inc ...

  2. sql数据表的设计思路

    好的表结构分的比较细致,个人理解大概主要分为主表.明细.历史记录表.中间表,辅助表结构应该分为:类型表.状态表.统计表.统计明细表等.为了一个功能加那么多表实在是多余,如果写一个非常复杂的业务逻辑还是 ...

  3. 分页语句where条件中的子查询有or关键字优化

    背景 开发说: 有段SQL语句,去掉order by很快,有order by之后,查询1小时都无法返回结果. 我叫他把SQL扔给我看下. SQL代码及执行计划 select * from (selec ...

  4. 牛客网 牛可乐发红包脱单ACM赛 A题 生成树

    [题解] 其实就是求两棵树不同的边有多少条.那么我们用一个set来去重即可. #include<cstdio> #include<cstring> #include<se ...

  5. 大数据学习——mapreduce程序单词统计

    项目结构 pom.xml文件 <?xml version="1.0" encoding="UTF-8"?> <project xmlns=&q ...

  6. 大数据学习——Linux上常用软件安装

    4.1 Linux系统软件安装方式 Linux上的软件安装有以下几种常见方式: 1.二进制发布包 软件已经针对具体平台编译打包发布,只要解压,修改配置即可 2.RPM发布包 软件已经按照redhat的 ...

  7. 省市区名称code

    https://blog.csdn.net/hichinamobile/article/details/51725090 --省 create table t_base_provinces( id ) ...

  8. python021 Python3 错误和异常

    Python3 错误和异常 作为Python初学者,在刚学习Python编程时,经常会看到一些报错信息,在前面我们没有提及,这章节我们会专门介绍. Python有两种错误很容易辨认:语法错误和异常. ...

  9. bzoj 3772 精神污染 主席树+dfs序

    精神污染 Time Limit: 10 Sec  Memory Limit: 64 MBSubmit: 637  Solved: 177[Submit][Status][Discuss] Descri ...

  10. FusionCharts for Flex 如何更改图表数据

    FusionCharts allows to change chart data and re-render the chart, after it has loaded on the user’s ...