ps -ef | grep mysql | grep -v grep
root 17184 1 0 2018 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/db/data1 --pid-file=/var/run/mysqld/mysqld.pid
mysql 17902 17184 0 2018 ? 01:14:22 /usr/sbin/mysqld --basedir=/usr --datadir=/db/data1 --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysql/mysqld.err --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306
cat /proc/17902/limits
Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited seconds
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 8388608 unlimited bytes
Max core file size 0 unlimited bytes
Max resident set unlimited unlimited bytes
Max processes 15066 15066 processes
Max open files 5000 5000 files
Max locked memory 65536 65536 bytes
Max address space unlimited unlimited bytes
Max file locks unlimited unlimited locks
Max pending signals 15066 15066 signals
Max msgqueue size 819200 819200 bytes
Max nice priority 0 0
Max realtime priority 0 0
Max realtime timeout unlimited unlimited us
如您所见,“最大打开文件数”硬限制和软限制设置为5000。我的问题是:此值设置在哪里? 我已经检查了以下文件:
/etc/security/limits.d/20-nproc.conf =>这是limits.d下的唯一文件。内容:
* soft nproc 4096
root soft nproc unlimited
ulimit -n作为root:1024
ulimit -n作为用户mysql:1024
/etc/my.cnf不包含max_open_files值
/etc/my.cnf.d为空
您知道在哪里设置此值吗?
答案 0 :(得分:0)
这应取决于您在/etc/security/limits.conf中设置的内容,有关更多详细信息,请参见此处https://unix.stackexchange.com/questions/152186/mysql-max-open-files-more-than-1024 最终考虑添加my.cnf的全部内容