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

灰太狼 2023-10-05 18:19 46阅读 0赞

启动mariadb,查看mariadb状态信息时:

  1. systemctl start mariadb
  2. systemctl -l status mariadb

报错

在这里插入图片描述

[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)
出现警告信息:提示最大打开文件数不能超过1024,但依然能够启动mariaDB。

解决方法

  • cat /usr/lib/systemd/system/mariadb.service 查看信息

    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

  • 根据前面的信息

    mkdir /etc/systemd/system/mariadb.service.d
    vim /etc/systemd/system/mariadb.service.d/limits.conf ‘ //添加 ‘
    [Service]
    LimitNOFILE=10000 ‘ //根据前面的warning信息,数值只需要大于8131即可,还可以改为infinity ‘

  • 修改完之后,重新加载配置

    systemctl —system-daemon-reload

已解决

如图:
在这里插入图片描述

拓展

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

发表评论

表情:
评论列表 (有 0 条评论,46人围观)

还没有评论,来说两句吧...

相关阅读