小编J P*_*ret的帖子

Ubuntu 16.04 服务器 MySql open_file_limit 不会高于 65536

我在 XenServer 上运行 Ubuntu 16.04 Server,但遇到了 MySql 的打开文件限制问题。

这是我到目前为止所做的:

sudo nano /etc/security/limits.conf (参考)

* soft nofile 1024000
* hard nofile 1024000
* soft nproc 102400
* hard nproc 102400
mysql soft nofile 1024000
mysql hard nofile 1024000
Run Code Online (Sandbox Code Playgroud)

sudo nano /etc/init/mysql.conf (参考)

limit nofile 1024000 1024000
limit nproc 102400 102400
Run Code Online (Sandbox Code Playgroud)

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf (参考)

[mysqld_safe]
open_files_limit = 1024000


[mysqld]
open_files_limit = 1024000
Run Code Online (Sandbox Code Playgroud)

当上述方法不起作用时,我继续执行以下操作:

须藤纳米 /etc/sysctl.conf

fs.file-max = 1024000
Run Code Online (Sandbox Code Playgroud)

须藤纳米 /etc/pam.d/common-session

session required pam_limits.so
Run Code Online (Sandbox Code Playgroud)

须藤纳米 /etc/pam.d/common-session-noninteractive

session required pam_limits.so
Run Code Online (Sandbox Code Playgroud)

须藤纳米/lib/systemd/system/mysql.service

LimitNOFILE=infinity
LimitMEMLOCK=infinity …
Run Code Online (Sandbox Code Playgroud)

mysql ulimit max-file-descriptors file-descriptors

17
推荐指数
1
解决办法
1万
查看次数