文章

mariadb调整数据库最大连接

mariadb调整数据库最大连接

本文档介绍 mariadb调整数据库最大连接 的相关内容。

检查Mysql最大连接数

show variables like '%connect%'; show variables like '%max_connections%'; max_connections 默认为214

在配置文件中增加

max_connections=10000 # 发现最大连接数改为214并不是我们设置的10000。。。这是因为Mariadb有默认的打开文件数限制。

配置Mariadb打开文件数,修改/usr/lib/systemd/system/mariadb.service文件,在[Service]下新增如下配置:

vim /usr/lib/systemd/system/mariadb.service 增加: [Service] ... LimitNOFILE=65535 LimitNPROC=65535 ... systemctl daemon-reload systemctl restart mariadb

临时设置

set GLOBAL max_connections=10000

主从延时复制

CHANGE MASTER TO MASTER_DELAY = N; N为多少秒,该语句设置从数据库延时多少秒后再与主数据库同步复制
本文由作者按照 CC BY 4.0 进行授权