无法在 centos7 上的 mariadb 10 中增加 open-files-limit

2022-01-15 00:00:00 mariadb mysql

我搜索了主题主题并测试了选项,但我仍然无法增加用作 cpanel/whm 服务器的远程数据库服务器的 mariadb 服务器上的打开文件限制.这是很好的参考http://duntuk.com/how-raise-ulimit-open-files-and-mysql-openfileslimit

I searched about the topic subject and tested options, but I still cant increase the open-files-limit on my mariadb server that is used as remote database server for cpanel/whm server. here is s good reference http://duntuk.com/how-raise-ulimit-open-files-and-mysql-openfileslimit

我增加了

/etc/my.cnf 

open-files-limit=65550

这是一些结果

#ulimit -a 
    core file size          (blocks, -c) 0
    data seg size           (kbytes, -d) unlimited
    scheduling priority             (-e) 0
    file size               (blocks, -f) unlimited
    pending signals                 (-i) 63471
    max locked memory       (kbytes, -l) 64
    max memory size         (kbytes, -m) unlimited
    open files                      (-n) 65535
    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

最大用户进程 (-u) 65535虚拟内存 (kbytes, -v) 无限制文件锁 (-x) 无限制

max user processes (-u) 65535 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited

#ulimit -Hn -Sn                              
open files                      (-n) 65535
open files                      (-n) 65535

cat /etc/systemd/system/mariadb.service.d/limits.conf 
[Service]
LimitNOFILE=65500

cat /usr/lib/systemd/system/mariadb.service

[Unit]
Description=MariaDB database server
After=syslog.target
After=network.target

[Service]
Type=simple
User=mysql
Group=mysql
LimitNOFILE=infinity
LimitMEMLOCK=infinity

我仍然在 mysql 中

and still in mysql I get

显示全局变量,如open%";

show global variables like 'open%';

+------------------+------+

+------------------+-------+

|变量名 |价值 |

+------------------+------+

+------------------+-------+

|open_files_limit |第1024章|

| open_files_limit | 1024 |

+------------------+------+

+------------------+-------+

集合中的 1 行(0.00 秒)

1 row in set (0.00 sec)

重启后我一遍又一遍地出现以下错误

and im getting following error over and over after restart

60108 16:30:02 [ERROR] mysqld: Can't open file: './username_wp/wp_users.frm' (errno: 24)
160108 16:30:02 [ERROR] Error in accept: Too many open files
160108 16:30:04 [ERROR] Error in accept: Too many open files
160108 16:30:06 [ERROR] Error in accept: Too many open files
160108 16:30:11 [ERROR] mysqld: Can't open file: './username_db/strikes.frm' (errno: 24)

这是mariadb的启动日志

and here is the startup log of mariadb

[Warning] Could not increase number of max_open_files to more than 1024 (request: 132107)

推荐答案

终于找到了解决方案,但没有任何合理的原因!我正在运行 MariaDB 5.5,所有设置都很好,但软限制不超过 1024!我以为我的 mariadb 是 10.0,因为我刚刚安装了它

finally i find solution but without any reasonable cause ! i was running MariaDB 5.5 and all settings where fine but the soft limit did not goes more than 1024 ! i was thinking my mariadb is 10.0 as i freshly installed it

在我发现它是 5.5 之后,我尝试将它升级到 v10.0 !然后繁荣!无需任何额外操作或设置即可解决问题(内核设置允许最大文件限制,如参考链接中所述)

after i find out that its 5.5 i tried to upgrade it to v10.0 ! and then BOOM ! problem solved without any extra action or setting ( kernel setting allows maximum files limit as described in reference link )

我希望它可以帮助其他人遇到同样的问题(但在尝试所有其他必需的设置之后)

i hope it help other peoples have same problem ( but after try all other required settings )

相关文章