我正在尝试为CentOS 7上的MariaDB版本5.5.60更改max_connections和open_files_limit。因为可能有多个my.cnf文件,所以我使用mysql --help --verbose来获取可能的位置。下面是输出:
Default options are read from the following files in the given order:
/etc/mysql/my.cnf /etc/my.cnf ~/.my.cnf Cnf.etc/ mysql /my.cnf不存在,根也不在我的用户目录、/ .my.cnf /或mysql用户目录(一开始就不存在)中。所以只剩下/etc/my.cnf。它看起来是这样的:
[mysqld]
datadir=/data/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
max_connections = 5000
open_files_limit = 10240
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d最后一行中的/etc/my.cnf.d包含server.cnf,其中包括以下两行:
[server]
max_connections=5000
open_files_limit=10240但是,当我运行systemctl restart mariadb时,只有max_connections被更改,但我就是不能让它读取open_files_limit的新值。它一直在这样做:
MariaDB [(none)]> SHOW VARIABLES LIKE 'open_files_limit';
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| open_files_limit | 1024 |
+------------------+-------+
1 row in set (0.00 sec)您是否知道它为什么这样做,以及如何让服务器读取open_files_limit的新值
提前谢谢你
萨沙
发布于 2021-10-11 10:38:14
open_file_limits变量的值不能高于系统限制。
检查ulimit -n的输出并更改系统配置。最好不要在系统范围内分配这些限制,而是为运行MariaDB服务器的用户分配这些限制。
https://stackoverflow.com/questions/69521424
复制相似问题