Cannot increase open-files-limit
I have a LEMP stack on Ubuntu 14.04 with 10.0.17-MariaDB-1trusty. Mysql is a huge bottleneck for my server. I have tried everything of which I am aware to raise the open files limit for mysql. I have added "open-files-limit = 2097152" to my.cnf. I have added the following to limits.conf:
- * soft nofile 2097152
- * hard nofile 2097152
- * soft nproc 2097152
- * hard nproc 2097152
- mysql soft nofile 2097152
- mysql hard nofile 2097152
- mysql soft nproc 2097152
- mysql hard nproc 2097152
I have added "session required pam_limits.so" to /etc/pam.d/common-session* and /etc/pam.d/sudo and a couple of others. I have tried restarting mysql after reboot - no change. I also checked /etc/apparmor.d/usr.sbin.mysqld to see if it was involved but the file is empty. After all that I still get the following:
- #ulimit -Sa
- core file size (blocks, -c) 0
- data seg size (kbytes, -d) unlimited
- scheduling priority (-e) 0
- file size (blocks, -f) unlimited
- pending signals (-i) 256538
- max locked memory (kbytes, -l) unlimited
- max memory size (kbytes, -m) unlimited
- open files (-n) 1024
- pipe size (512 bytes, -p) 8
- POSIX message queues (bytes, -q) 819200
- real-time priority (-r) 0
- stack size (kbytes, -s) 8192
- cpu time (seconds, -t) unlimited
- max user processes (-u) 2097152
- virtual memory (kbytes, -v) unlimited
- file locks (-x) unlimited
When I run # mysqld --verbose I get this:
- 150501 0:19:35 [Warning] Could not increase number of max_open_files to more than 1024
Does anyone have any idea as to what is blocking this change???
Answer Answered by Daniel Black in this comment.
If the OS isn't using systemd make sure that the open-file-limit is in the [mysqld_safe] section of the my.cnf file to raise the hard limit.