LoginSignup
3
1

More than 5 years have passed since last update.

[Docker]多数ゲストOS上のservice mysqld startが[FAILED]になるときの対処法

Last updated at Posted at 2017-07-27

1つのホストに多数のゲストOS(コンテナ)を立ち上げて、それぞれでservice mysqld startをやると、何度やってもあるところから失敗することがある。
(自分の場合は24個目のコンテナ以降すべて失敗した)

# service mysqld start
Starting mysqld (via systemctl):  Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
                                                           [FAILED]

毎回失敗する場所が同じなので、おそらく何かのしきい値が低いとかだと思った。

まずログを見てみる。

/var/log/mysqld.log
2017-07-26 14:40:09 333 [Note] Plugin 'FEDERATED' is disabled.
2017-07-26 14:40:09 333 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-07-26 14:40:09 333 [Note] InnoDB: The InnoDB memory heap is disabled
2017-07-26 14:40:09 333 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-07-26 14:40:09 333 [Note] InnoDB: Memory barrier is not used
2017-07-26 14:40:09 333 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-07-26 14:40:09 333 [Note] InnoDB: Using Linux native AIO
2017-07-26 14:40:09 333 [Note] InnoDB: Not using CPU crc32 instructions
2017-07-26 14:40:09 7f97ece2c740 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.
2017-07-26 14:40:12 7f97ece2c740 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
2017-07-26 14:40:12 333 [ERROR] InnoDB: Fatal : Cannot initialize AIO sub-system
2017-07-26 14:40:12 333 [ERROR] Plugin 'InnoDB' init function returned error.
2017-07-26 14:40:12 333 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2017-07-26 14:40:12 333 [ERROR] Unknown/unsupported storage engine: InnoDB
2017-07-26 14:40:12 333 [ERROR] Aborting


(略)

You can disable Linux Native AIO by setting innodb_use_native_aio = 0 in my.cnf
と言うとおり、my.cnfにinnodb_use_native_aio = 0を追記してみたが変わらず。

結果を言うと、ホストの/proc/sys/fs/aio-max-nrの値が低すぎるということみたい。
適当な大きい値を上記ファイルに入れてみる。

echo 500000 > /proc/sys/fs/aio-max-nr

これでゲストOSでmysqldをstartできました。

3
1
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1