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 |
+-----------------------+-------+
完!
