forcemax's

회사 서비스 서버중 DB 서버가 4GB의 메모리를 갖고 있는데 우리가 많이 사용하는 max_connections 계산식에 대입해보면 max_connections값으로 1333을 설정할 수 있다고 한다.

그런데 아무리 [mysqld] 섹션에 max_connections 값으로 1200을 설정해도 적용이 안되고 show variables 해보면 max_connections값이 886으로 되어 있다.

이러한 이유에서 찾아보니 다음의 두가지 설정이 중요하였다.

일단 /etc/mysql/my.cnf에는 다음의 설정을 넣어준다.

[mysqld]
max_connections = 1200
open-files-limit = 4096

그리고 한 process의 최대 open files 값을 변경하기 위해 /etc/security/limits.conf 에 다음 설정을 추가한다.

mysql           soft    nofile          4096
mysql           hard    nofile          4096

mysql 데몬을 재시작하자!