mariadb 修改最大连接数
mariadb配置文件中添加max_connections=3000后,登陆系统查看:
MariaDB [(none)]> show global variables like '%max_conn%';
+-----------------------+-------+
| Variable_name | Value |
+-----------------------+-------+
| extra_max_connections | 1 |
| max_connect_errors | 100 |
| max_connections | 214 |
+-----------------------+-------+
很疑惑,为啥参数改了,最大才到214呢?
百度了一下,找到了答案,很强大的百度,https://blog.csdn.net/pittpakk/article/details/79611312
根据博文介绍,需要修改一个文件,添加参数,如下:
由于mariadb有默认打开文件数限制
vi /usr/lib/systemd/system/mariadb.service
添加
LimitNOFILE=10000
LimitNPROC=10000
重载系统服务和mariadb服务
systemctl --system daemon-reload
systemctl restart mariadb.service
再次查看,奇迹出现了,
MariaDB [(none)]> show global variables like '%max_conn%';
+-----------------------+-------+
| Variable_name | Value |
+-----------------------+-------+
| extra_max_connections | 1 |
| max_connect_errors | 100 |
| max_connections | 3000 |
+-----------------------+-------+
完!