欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

MySQL的如何计算打开文件数(3)_MySQL

程序员文章站 2022-05-31 11:15:44
...
bitsCN.com

  而这个时候,按计算公式结果如下:
  | max_connections | 100 |
  | table_open_cache | 1000 |
  来计算一下:
  max_open_files_1 = max_connections + table_cache * 2 = 100 + 1000 * 2 = 2100
  max_open_files_2 = max_connections*5 = 100 * 5 = 500
  6. 修改 ulimit 试试看:

  unlimit -n 5000
  vi /etc/my.cnf
  ...
  open_files_limit = 10000
  ...
  /etc/init.d/mysql restart
  mysql>show global variables like '%open%';
  | open_files_limit | 10000 |
  | table_open_cache | 1000 |
  open_files_limit 比内核最大限制数还大,因此以 open_files_limit 为准。
   vi /etc/my.cnf
  ...
  #open_files_limit = 10000
  ...
  /etc/init.d/mysql restart
  mysql>show global variables like '%open%';
  | open_files_limit | 5000 |
  | table_open_cache | 1000 |
  看到了,变成了新的内核最大限制
  看到了吧,结果完全跟文档描述的以及mysql源码中写的不一样,看来预编译版本有些地方不太可靠啊 :(
  以上测试在mysql 5.1.23-rc(预编译), mysql-5.1.24-rc(自编译) 以及 5.0.45(预编译) 均一样。

  uname -a
  Linux s1.yejr.com 2.6.9-55.ELsmp #1 SMP Fri Apr 20 16:36:54 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux
  mysql> select version();
  +---------------+
  | version() |
  +---------------+
  | 5.1.23-rc-log |
  +---------------+

bitsCN.com
相关标签: 计算 如何