在一台服务器中以各数据库的备份文件为数据文件启动多个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源码来避免该问题的,但一般情况下不推荐也没有必要这么做。
相关推荐
Mysql可以正常启动,但innodb的表无法使用 在错误日志里你会看到如下输出: InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes 现在需要做的事情就是把原来的 innodb 的ib_logfile×...
主要介绍了MySQL启动报错问题InnoDB:Unable to lock/ibdata1 error,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
2017-11-15 19:23:48 fc8 InnoDB: Rolling back trx with id 275035944, 0 rows to undo 2017-11-15 19:23:48 fc8 InnoDB: Assertion failure in thread 4040 in file fut0lst.ic line 83 InnoDB: Failing assertion...
mysql 有关“InnoDB Error ib_logfile0 of different size”错误的解决方法,需要的朋友可以参考下。
这样的好处,减少了事务数据丢失的概率,而对底层硬件的 IO 要求也没有那么高(log buffer 写到文件系统中,一般只是从 log buffer 的内存转移
InnoDB Operating system error number 9. [MDEV-9749] InnoDB receives 'Bad file descriptor' error, possibly related to feedback plugin Lost connection to MySQL server at 'handshake- reading initial ...
MySQL技术InnoDB存储引擎_姜承尧_第2版
innodb_data_file_path用来指定innodb tablespace文件,如果我们不在My.cnf文件中指定innodb_data_home_dir和innodb_data_file_path那么默认会在datadir目录下创建ibdata1 作为innodb tablespace。 说明 在测试环境...
内容包括: 1.MySQL的Innodb引擎配置 1.如何配置MySQL服务器的最大连接数量 2.如何配置innodb_open_files,table_open_cache,innodb_file_io_threads和innodb_buffer_pool_size,innodb_log_file_size
安全更新 之前 MySQL 加密安全连接只支持 TLSv...mysql_upgrade 尝试输出更多错误提示 FATAL ERROR: Upgrade failed 客户端程序支持 --enable-cleartext-plugin 选项:mysqlcheck, mysqldump, mysqlimport, mysqlshow.
前提条件,percona 5.6版本,事务隔离级别为RR mysql> show create table test_autoinc_lock\G *************************** 1. row *************************** Table: test_autoinc_lock Create Table: CREATE ...
MySQL Innodb 参数详解与优化实践
详细介绍了 Innodb 存储引擎在线备份工具 ibackup 的使用。
目录MySQL 3534 Error1. 问题2. 解决步骤3....-2017-11-07T12:25:58 [ERROR] InnoDB: Operating system error number 87 in a file operation -2017-11-07T12:25:58 [ERROR] InnoDB: File .\ib_logfile101
:beach_with_umbrella: :foggy: :postbox: :magnifying_glass_tilted_left: :rocket: :rainbow: :light_bulb: jdk源码阅读 MySQL详解--基于innoDB引擎 Spring源码笔记 Mybatis源码笔记 算法 面试题 简答题 编程题 ...