[systemd-devel] mysql open_files_limit controlled by systemd

Lennart Poettering lennart at poettering.net
Fri Oct 7 10:37:09 UTC 2016

On Thu, 29.09.16 11:20, Hajo Locke (Hajo.Locke at gmx.de) wrote:

> Hello List,
> we found out that mysql open_files_limit ist controlled by systemd-service
> file. We used LimitNOFILE to increase default value.
> This value is always overwriting the value from my.cnf file.
> Is there a way to tell systemd to not control a service in this way so
> control completely goes back to original my.cnf values?
> At the moment i did not found a promising directive.

On Linux, RLIMIT_NOFILE may be altered freely by privileged processes,
but unprivileged processes may only lower it.

This means that as long as mysql is invoked privileged it can alter
RLIMIT_NOFILE as it likes, and systemd's setting is little more than
the default.

If mysql is invoked unprivileged (which might well be the case, I
don't know the mysql service file or the the code of mysqld), then the
systemd unit file setting LimitNOFILE will enforce an upper limit, and
mysql can only lower it from there. In this case, simply set
LimitNOFILE to a really high value: e.g LimitNOFILE=8388608 (which is
8M), so that it doesn't have too much effect.

Note that systemd's defaults for this value are just the kernel's
defaults, and there's nothing going on beyond that.


Lennart Poettering, Red Hat

More information about the systemd-devel mailing list