MySQL --open-files-limit 옵션

mysql의 myisam은 테이블 한개당 파일 디스크립터 2개가 필요하다.
테이블이 많은 서버의 경우 Too many open files 에러가 나면서 접속이 잘 안되는
경우가 있는데 my.cnf 에 open_files_limit = 숫자 와 같은 식으로 open_files_limit 값을
증가시켜주면 된다.

그런데 이 값은 최대 65535까지 설정이 가능한데 정말 많은 테이블을
가지고 있는 서버의 경우에는 이 값 이상이 필요한 경우가 있다.
이럴 경우에는 mysql 시작 시 옵션으로 설정해줘야 한다.

centos 5의 경우 /etc/init.d/mysqld 가 시작 스크립트이다.
61번째줄을 보면 다음과 같을 것이다.

/usr/bin/mysqld_safe   –datadir=”$datadir” –socket=”$socketfile” \
–log-error=”$errlogfile” –pid-file=”$mypidfile” \
–user=mysql >/dev/null 2>&1 &

여기에 –open-files-limit 옵션을 추가해준다.

/usr/bin/mysqld_safe   –datadir=”$datadir” –socket=”$socketfile” \
–log-error=”$errlogfile” –pid-file=”$mypidfile” \
–user=mysql –open-files-limit=102400 >/dev/null 2>&1 &

my.cnf에는 open_files_limit 옵션이고 mysql 시작 스크립트에는 –open-files-limit 옵션이다.

2 comments to MySQL –open-files-limit 옵션

  • init 스크립트의 mysqld_safe command option을 굳이 수정할 필요없이 system variable인 open_files_limit 대신 server option인 open-files-limit를 my.cnf에 써주시면 됩니다.

  • 글쓴분의 얘기처럼 mysql의 옵션을 수정하는 게 맞을 것 같습니다.
    system variable 는 system을 위해서 존재하기 때문에, system과 application 양쪽에
    한계치를 올려주는 게 올바르고요.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>