MariaDB [Warning] Could not increase number of max_open_files to more than 1024

When mariadb is started and the status of mariadb is viewed:

systemctl start mariadb
systemctl -l status mariadb

Report an error

Insert picture description here

[Warning] Could not increase number of max_open_files to more than 1024 (request: 8131)
[Warning] Changed limits: max_open_files: 1024 max_connections: 594 (was 4096) table_cache: 200 (was 2000)
A warning message appears: prompting the maximum number of open files Cannot exceed 1024, but still able to start mariaDB.

Solution

  • cat /usr/lib/systemd/system/mariadb.service View information
 14 # For example, if you want to increase mysql's open-files-limit to 10000,
 15 # you need to increase systemd's LimitNOFILE setting, so create a file named
 16 # "/etc/systemd/system/mariadb.service.d/limits.conf" containing:
 17 #       [Service]
 18 #       LimitNOFILE=10000
  • According to the previous information
mkdir /etc/systemd/system/mariadb.service.d
vim /etc/systemd/system/mariadb.service.d/limits.conf   '  //添加  '
[Service]
LimitNOFILE=10000     '  //根据前面的warning信息,数值只需要大于8131即可,还可以改为infinity '
  • After modification, reload the configuration
systemctl --system-daemon-reload

solved

As shown:
Insert picture description here

expand

ulimit -n       查看当前进程的max_open_files
cat /proc/sys/fs/file-max       查看系统最大文件数
/etc/security/limits.conf是一个很重要的文件

Guess you like

Origin blog.csdn.net/qq_46480020/article/details/113059430