Last active
April 4, 2021 14:06
-
-
Save gseldon/a044d41a1e9563d9480f09122619545e to your computer and use it in GitHub Desktop.
Mysql Max connection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Узнать максимальное коллличество используемых подключений параметра в базе | |
$ mysql –u root –p | |
SHOW STATUS LIKE 'max_used_connections'; | |
-- Проверить максимальное коллличество подключений | |
# mysql -u root -p | |
mysql> show global variables like '%max_connections%'; | |
mysql> show global variables like '%open_files_limit%'; | |
mysql> show global variables like '%table_open_cache'; | |
-- Повысить коллличество максимальных подключений в базе | |
$ mysql –u root –p | |
mysql> SET GLOBAL max_connections = 512; | |
-- После проверки внесни измененией в конфигурацию базы | |
# vi /etc/my.cnf | |
max_connections = 512 | |
systemctl restart mysqld | |
=============================================================================================== | |
-- Проверить нет ли ограничения на коллличество открытых файлов. | |
-- Запускаем его perl mysqltuner.pl, в логе видим [Warning] Buffered warning: Could not increase number of max_open_files to more than 1024 (request: 5000) | |
В система с systemd воспользоваться встроенным редактором для служб | |
systemctl edit mysql.service | |
[Service] | |
LimitNOFILE=2048 | |
systemctl daemon-reload | |
Если версия ОС без systemd | |
Нужно разрешить там: | |
mkdir /etc/systemd/system/mysql.service.d | |
nano /etc/systemd/system/mysql.service.d/limits.conf | |
[Service] | |
LimitNOFILE=10000 | |
LimitMEMLOCK=10000 | |
или | |
[Service] | |
LimitNOFILE=infinity | |
LimitMEMLOCK=infinity | |
https://dima.stefantsov.com/izmenit-limit-open-files-limit-max_open_files-mysql-server/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment