Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add open-files-limits to upstart/init.d scripts #4

Open
epcim opened this issue Sep 2, 2016 · 1 comment
Open

add open-files-limits to upstart/init.d scripts #4

epcim opened this issue Sep 2, 2016 · 1 comment

Comments

@epcim
Copy link
Member

epcim commented Sep 2, 2016

http://askubuntu.com/questions/288471/mysql-cant-open-files-after-updating-server-errno-24

OS: Ubuntu (Debian) deployments

For init.d probably setting ulimit -n xxx might be accepted. For upstart etc..:

MySQL Server Option: open-files-limit

It seems that the Debian upstart doesn't use the parameters defined in /etc/security/limits.conf, so when you launch mysql through the service command (and so, under upstart), it overrides those defined limits and uses the default 1024.

The solution is to modify the mysql.conf file that defines the upstart service, it is located in /etc/init/mysql.conf and add the following lines before the pre-start block:

# NB: Upstart scripts do not respect
# /etc/security/limits.conf, so the open-file limits
# settings need to be applied here.
limit nofile 32000 32000
limit nproc 32000 32000
References:

http://serverfault.com/questions/440878/changing-open-files-limit-in-mysql-5-5
http://dev.mysql.com/doc/refman/5.5/en/server-options.html#c12634
shareimprove this answer
answered Apr 30 '13 at 14:21

@epcim
Copy link
Member Author

epcim commented Sep 2, 2016

Proposed solution:

http://duntuk.com/how-raise-ulimit-open-files-and-mysql-openfileslimit

/etc/init.d/mysqld
ulimit -S -n ${DAEMON_FILES_LIMIT:-102400} >/dev/null 2>&1

/etc/my.cnf

[myqld_safe]
open_files_limit = 102400

[myqld]
open_files_limit = 102400

for systemd

cd /etc/systemd/system/


rm mysql.service
#Copy service to services directory (so it won't be overwritten by any upgrade):
cp /usr/lib/systemd/system/mysqld.service mysqld.service

# In the Service section add LimitNOFILE=1024000.
[Service]
User=mysql
Group=mysql
LimitNOFILE=1024000```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant