0

i`were delegated to manage a MySQL-Server(RHEL 7) and now i have a strange Situation. The RPM-Package is from Oracle, which is using init.d-scripts and not systemd. If i check the limits of the running MySQL-Server-Process, i get 5000. Let me show you how i checked that:

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  

As you can see, "Max open files" hard and soft limit is set to 5000. My question is: where is this value set? I have already checked the following files:

  • /etc/security/limits.conf => This file is empty, except some commentaries
  • /etc/security/limits.d/20-nproc.conf => This is the only file under limits.d. Content:

    *          soft    nproc     4096
    root       soft    nproc     unlimited
    
  • ulimit -n as root: 1024

  • ulimit -n as user mysql: 1024

  • /etc/my.cnf doesnt contain an max_open_files value

  • /etc/my.cnf.d is empty

Any idea where this value is set?

C_o_H
  • 1
  • 2

2 Answers2

0

That should be depending on what you set in /etc/security/limits.conf , for more details see here https://unix.stackexchange.com/questions/152186/mysql-max-open-files-more-than-1024 Eventually consider to add the whole content of my.cnf

A. Lion
  • 673
  • 5
  • 12
  • I meant that, as from the linked thread soluton with the higher number of votes that limit should be set to a larger value than default by: Edit /etc/security/limits.conf and add the following lines mysql soft nofile 65535 mysql hard nofile 65535 Eventually if it does not work include whole content of my.cnf Cheers – A. Lion Feb 01 '19 at 08:54
  • thank you. I do not have a problem at the moment, but i`m trying to understand what predecessor has done and especially how. And here, i have no idea how he set the max open files to 5000. – C_o_H Feb 01 '19 at 15:04
0

I was also experiencing a 'Max open files' limit of 5000 for my mysql process and, based on the discussion in https://unix.stackexchange.com/questions/152186/mysql-max-open-files-more-than-1024, found the corresponding LimitNOFILE configuration in /usr/lib/systemd/system/mysql.service (plain Ubuntu 20.04).

hkasur
  • 1