MySQL:5.7.11 超过最大打开文件数crash原因和参数open_files_limit

作者简介:高鹏,笔名八怪。《深入理解MySQL主从原理》图书作者,同时运营个人公众号“MySQL学习”,持续分享遇到的有趣case以及代码解析!

一、问题重现

版本5.7.11,我们首先设置参数:

  • max_connections = 20
  • table_open_cache = 20
  • table_definition_cache=10
  • open_files_limit=300
  • innodb_open_files=300
  • OS中设置 hard nofile 300 soft nofile 300

这样重启后我们的数据库中open_files_limit设置为300如下:

mysql> show variables like '%open_files_limit%'; +------------------+-------+ | Variable_name    | Value | +------------------+-------+ | open_files_limit | 300   | +------------------+-------+ 1 row in set (0.00 sec)