[Warning] Changed limits: max_open_files: 5000 (requested 20480)
Metaphysical sauce 2018-01-05 15:01:00 Views 113 Comments 0
Summary: It is proposed that the mysql log prompts Warning # ulimit -Sa | grep "open files" open files (-n) 40960 [root @netkiller ~]...
It is proposed that the mysql log prompts Warning if there is no problem with the CentOS 7 ulimit configuration
# ulimit -Sa | grep "open files" open files (-n) 40960
[root@netkiller ~]# cat /proc/`pidof mysqld`/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 63494 63494 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 63494 63494 signals Max msgqueue size 819200 819200 bytes Max nice priority 0 0 Max realtime priority 0 0 Max realtime timeout unlimited unlimited us
[root@netkiller ~]# egrep '^(Limit|Max open files)' /proc/`pidof mysqld`/limits Limit Soft Limit Hard Limit Units Max open files 5000 5000 files
The problem occurs because the systemctl startup script overwrites the ulimit configuration
# cat /usr/lib/systemd/system/mysqld.service | grep -A2 open_files_limit # Sets open_files_limit LimitNOFILE = 5000
The solution is to directly modify the above value. It is not recommended to modify mysqld.service, which will affect your next upgrade. Please use the following solution to solve it perfectly:
mkdir /usr/lib/systemd/system/mysqld.service.d cat >> /usr/lib/systemd/system/mysqld.service.d/override.conf <<EOF [Service] LimitNOFILE = 40960 EOF
systemctl daemon-reload systemctl restart mysqld