mariadb 下 too many connections 问题,mariadbconnections
1. 在业务敏感度不高时,首先重启服务紧急处理
systemctl start mariadb #启动MariaDB
systemctl stop mariadb #停止MariaDB
systemctl restart mariadb #重启MariaDB
systemctl enable mariadb #设置开机启动
2. 现象原因: 有多个线程连接mysql服务,导致超出连接限制
3. 查看默认连接数
mysql
show variables like '%connection%';
可以看到返回为
max_connections 一般默认为 161
4. 修改方案, 要修改mysql的配置,然后重启mariadb服务,更新max_connections的值
4.1 查看mysql读取配置文件的顺序
mysql --help | grep my.cnf
按照路径可以选取第一个,如果没有可以新建文件。写入
[mysqld]
max_connections = 1000
4.2 配置/usr/lib/systemd/system/mariadb.service
[Service]新添加两行如下参数:
LimitNOFILE=10000
LimitNPROC=10000
4.3 重新加载系统服务,并重启mariadb服务
systemctl --system daemon-reload
systemctl restart mariadb
4.4 重复3的步骤,确认修改效果
本站文章为和通数据库网友分享或者投稿,欢迎任何形式的转载,但请务必注明出处.
同时文章内容如有侵犯了您的权益,请联系QQ:970679559,我们会在尽快处理。