티스토리 뷰


Max connection이 늘어나지 않아. 왜이러지


mysql> show variables like 'max_connect%';

+--------------------+-------+

| Variable_name      | Value |

+--------------------+-------+

| max_connect_errors | 100   |

| max_connections    | 214   |

+--------------------+-------+







[mysqld]

.....

max_connections=1000



나는 분명 1000으로 늘렸는데 .. Restart도 했거든..근데 왜 안늘어나지?

고장인가??


그럼 214 이하로 설정해보자



[mysqld]

.....

max_connections=150




mysql> show variables like 'max_connect%';

+--------------------+-------+

| Variable_name      | Value |

+--------------------+-------+

| max_connect_errors | 100   |

| max_connections    | 150   |

+--------------------+-------+


된다....뭐지... 이하는 되는데.214이상으로 올라가진 않아..왜지...

검색..검색....




---------------------

해답 : 

MySQL 은 매 connection 마다 몇개의 file을 오픈함.


OS 에서 open file 제한이 걸려있다면, max_connection 은 해당 open file 에 설정되어있는 일정값 이상으로 올릴수 없음..


[root@test ~]# ulimit -Sa | grep "open files"

open files                      (-n) 1024




보니까..1024로 되어있네.
1024면 214 까지밖에안되어있나부지?
이걸 어떻게 올리는지 찾아보자


---

아 이걸 올릴필요는 없네. 1024면 충분하다 하고...


우선 보자 다른 파일들을 수정해야 한다.


------------------------------

1. 1024면 충분하다고 하니...우선 limit.conf를 수정함

# vi /etc/security/limits.conf


를 보면...아마 아무것도 없을 것이다(주석만있고. 내경우는 그랬다)



#can be overriden with a wildcard setting in a config file in the

#subdirectory, but a user specific setting here can be ove..........

#ftp             hard    nproc           0

#@student        -       maxlogins       4


mysql hard nofile 65535

mysql soft nofile 65535


# End of file


 End of File 앞에 이 두줄 추가함


------------------------------


2. mysqld.service 도 수정함.

# vi /usr/lib/systemd/system/mysqld.service


.....

[Service]

User=mysql

Group=mysql

LimitNOFILE=65535

# Execute pre and post scripts as root

PermissionsStartOnly=true

.......


위와 같이 LimitNOFILE 65535추가

------------------------------


3. mysqld service 재시작



mysql> show variables like 'max_connect%';

+--------------------+-------+

| Variable_name      | Value |

+--------------------+-------+

| max_connect_errors | 100   |

| max_connections    | 3000  |

+--------------------+-------+


후후....

'Computer > DataBase' 카테고리의 다른 글

( MySQL ) 특정 조건 Count 하기  (2) 2016.05.11
(MySQL) Table index 확인법  (0) 2016.04.25
( MySql ) DB 최적화 작업 - 2  (0) 2016.04.22
( MySql ) DB 최적화 작업 - 1  (0) 2016.04.21
wait_timeout 조정  (0) 2016.04.01
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함