MariaDB - my.cnf를 통해 max_connections를 설정할 수 없습니다.
/etc/my.cnf에서 max_connections 파라미터를 설정하는데 어려움을 겪고 있는데 MariaDB가 파일에서 파라미터를 읽지 않는 것 같습니다.
/etc/my.cnf 파일:
[mysqld]
#skip-grant-tables
datadir=/data/mysql
socket=/data/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# network
connect_timeout = 60
wait_timeout = 28800
max_connections = 100000
max_allowed_packet = 64M
max_connect_errors = 1000
# limits
tmp_table_size = 512M
max_heap_table_size = 256M
table_cache = 512
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
[client]
port = 3306
socket= /data/mysql/mysql.sock
그러나 MariaDB에서 변수를 체크하면 다음과 같은 기본값이 표시됩니다.
MariaDB [(none)]> show variables like 'max_connections';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 214 |
+-----------------+-------+
1 row in set (0.00 sec)
그러나 my.cnf의 다른 파라미터는 정확합니다.
MariaDB [(none)]> show variables like 'wait_timeout';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout | 28800 |
+---------------+-------+
1 row in set (0.00 sec)
MariaDB [(none)]> show variables like 'max_allowed_packet';
+--------------------+----------+
| Variable_name | Value |
+--------------------+----------+
| max_allowed_packet | 67108864 |
+--------------------+----------+
1 row in set (0.00 sec)
MariaDB [(none)]> show variables like 'max_connect_errors';
+--------------------+-------+
| Variable_name | Value |
+--------------------+-------+
| max_connect_errors | 1000 |
+--------------------+-------+
1 row in set (0.00 sec)
MariaDB [(none)]> show variables like 'connect_timeout';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| connect_timeout | 60 |
+-----------------+-------+
1 row in set (0.00 sec)
이 변수는 mysql 명령줄에서 설정할 수 있지만 서비스를 재시작하면 자동으로 리셋됩니다.
MariaDB [(none)]> set global max_connections := 10000;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> show variables like 'max_connections';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 10000 |
+-----------------+-------+
1 row in set (0.00 sec)
OS: RHEL 7
MariaDB 버전: mariadb-server-5.5.47-1.el7_2.x86_64
여기를 참조해 주세요.https://dba.stackexchange.com/questions/137487/mariadb-cannot-set-max-connections-and-wait-timeout-through-my-cnf
해답은 여기 있는 것 같아요.열려 있는 파일 제한을 늘립니다.
https://dba.stackexchange.com/questions/12061/mysql-auto-adjusting-max-connections-values
ubuntu 서버에서도 같은 문제가 발생하고 있습니다.그리고 이 파일 /etc/my.cnf를 변경해야 합니다.
max_connections = 1000
쿼리를 실행합니다.잘못된 파일을 변경하고 있습니다.
마리아 DB가 있는 Ubuntu 서버에서 /etc/mysql/mariadb.conf.d/50-server.cnf에 매개 변수 max connections를 입력합니다.
서비스를 재시작하여 변경 내용을 적용합니다.
systemctl restart mariadb
네, 알아요, 괴상함. 하지만 이보다 더 좋은 답은 없어요. 그래서 이렇게 하죠.
저 자신도 오랫동안 이 문제로 고민해 왔습니다.다만, 오늘, 설정 파일내의 코멘트가 도움이 되는 경우가 있는 것을 깨달았습니다.즉, 회선번호로 식별되는 디렉토리2.이하에서 볼 수 있다/etc/mysql/mariadb.cnf:
# The MariaDB/MySQL tools read configuration files in the following order:
# 0. "/etc/mysql/my.cnf" symlinks to this file, reason why all the rest is read.
# 1. "/etc/mysql/mariadb.cnf" (this file) to set global defaults,
# 2. "/etc/mysql/conf.d/*.cnf" to set global options.
# 3. "/etc/mysql/mariadb.conf.d/*.cnf" to set MariaDB-only options.
# 4. "~/.my.cnf" to set user-specific options.
따라서 글로벌옵션을 다음 섹션에 추가해야 합니다.[mysqld]같은 파일로 변환합니다./etc/mysql/conf.d/myoptions.cnf
MariaDB를 재시작하면 설정이 그대로 유지됩니다.
언급URL : https://stackoverflow.com/questions/37021326/mariadb-cannot-set-max-connections-through-my-cnf
'IT' 카테고리의 다른 글
| JavaScript에 개체가 있는지 확인합니다. (0) | 2023.01.31 |
|---|---|
| MariaDB/MySQL에서 = 대신 <=>을(를) 사용하지 않는 경우 (0) | 2023.01.31 |
| 날짜 형식 지정(Moment.js) (0) | 2023.01.31 |
| Python 형식 문자열에서 %s의 의미는 무엇입니까? (0) | 2023.01.21 |
| 치명적 오류: 정의되지 않은 함수 mysql_connect() 호출 (0) | 2023.01.21 |