最大连接选项不适用于mysqld
我在最大连接选项不适用于mysqld,mysql,file,connection-pooling,Mysql,File,Connection Pooling,我在/etc/my.conf中设置了max_connections=2000,并重新启动了mysqld 但仍max_connectionsapear卡在412 mysql> SHOW VARIABLES LIKE "max_connections"; +-----------------+-------+ | Variable_name | Value | +-----------------+-------+ | max_connections | 412 | +--------
/etc/my.conf
中设置了max_connections=2000
,并重新启动了mysqld
但仍max_connections
apear卡在412
mysql> SHOW VARIABLES LIKE "max_connections";
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 412 |
+-----------------+-------+
1 row in set (0.01 sec)
mysql>
我还尝试重新启动mysqldpost
mysql> SET GLOBAL max_connections = 2000;
但在中,我仍然从查询中获得max|u connections | 412
显示变量,如“max_connections”代码>我通过更改打开文件数量的系统级限制来解决这个问题
检查系统级别。运行命令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) 31168
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1012
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
max user processes (-u) 4096
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
打开的文件
限制必须大于最大连接数的值
要更改此选项,请执行以下操作
sudo nano /etc/security/limits.conf
和添加/编辑
* hard nofile 4096
* soft nofile 4096
现在重新登录服务器,重新启动mysqld并检查
mysql> SHOW VARIABLES LIKE "max_connections";
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 2000 |
+-----------------+-------+
1 row in set (0.01 sec)
mysql>
我通过改变系统级对打开文件数量的限制来解决这个问题
检查系统级别。运行命令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) 31168
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1012
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
max user processes (-u) 4096
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
打开的文件
限制必须大于最大连接数的值
要更改此选项,请执行以下操作
sudo nano /etc/security/limits.conf
和添加/编辑
* hard nofile 4096
* soft nofile 4096
现在重新登录服务器,重新启动mysqld并检查
mysql> SHOW VARIABLES LIKE "max_connections";
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 2000 |
+-----------------+-------+
1 row in set (0.01 sec)
mysql>
为服务文件创建覆盖
systemctl编辑mysql.service
添加以下内容
重新启动MySQL服务器
服务mysql重启
为服务文件创建覆盖
systemctl编辑mysql.service
添加以下内容
重新启动MySQL服务器
服务mysql重启
将此作为知识QA共享。请仅编辑现有答案。将此作为知识QA共享。请仅编辑现有答案。这对我很有帮助。谢谢这对我有帮助。谢谢