查看参数:
ulimit -a
修改当前shell的设置:
ulimit -n 65535
这种方法只针对当前进程有效
修改系统参数
vi /etc/security/limits.conf
修改后重启服务器,使用ulimit -a查看结果没有改变。
以下方法用于修改mysql:open_files_limit限制,亲测有效。
第一步:
vi /etc/security/limits.d/99-openfiles.conf
#<domain> <type> <item> <value>
mysql soft nofile 8192
mysql hard nofile 8192
若要为所有用户设置:
#<domain> <type> <item> <value>
* soft nofile 8192
* hard nofile 8192
root soft nofile 8192
root hard nofile 8192
第二步:
systemctl edit mysql
[Service]
LimitNOFILE=8192
systemctl daemon-reload
service mysql restart
查看结果:
mysql> show global variables like 'open%';
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| open_files_limit | 8192 |
+------------------+-------+
1 row in set (0.00 sec)
mysql自带 的参数open_files_limit在my.cnf中设置,但实际设置后并未生效。