mysql默认最大连接数,即并发数是151。在生产中,这个数值偏低。想要修改数值。
vi /etc/my.cnf.d/mariadb-service.cnf
[mysqld]
max_connections=2000
systecmctl restart mardiadb.service
mysql -uroot
use mysql
mariadb[mysql]> show variables like ‘max_connections’
发现最大连接数 居然是594 。
查阅资料才知道,centos7和centos8版本的问题。
centos8已经修复了这个问题。但是centos7还要增加一个参数。添加如下:
vi /usr/lib/systemd/system/mariadb.service
[service]
LimitNOFILE=65536