Discussion:
mysql open_files_limit controlled by systemd
(too old to reply)
Hajo Locke
2016-09-29 09:20:34 UTC
Permalink
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.

Thanks,
Hajo
Tomasz Torcz
2016-09-29 09:30:23 UTC
Permalink
Post by Hajo Locke
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.
Set LimitNOFILE=infinity. Then your MySL may set the limit
on it own, to the value from my.cnf.
--
Tomasz Torcz 72->| 80->|
xmpp: ***@chrome.pl 72->| 80->|
Hajo Locke
2016-09-29 09:56:49 UTC
Permalink
Hello,
Post by Tomasz Torcz
Post by Hajo Locke
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.
Set LimitNOFILE=infinity. Then your MySL may set the limit
on it own, to the value from my.cnf.
Unfortunately this is not working. We set value in my.cnf lesser than
value in mysql.service, but its only the value in mysql.service which rules.
May be an OS specific setting? We use Ubuntu 16.04.
It would be nice to tell systemd to let some services make their own rules.

Thanks,
Hajo
Reindl Harald
2016-09-29 10:05:35 UTC
Permalink
Post by Hajo Locke
Hello,
Post by Tomasz Torcz
Post by Hajo Locke
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.
Set LimitNOFILE=infinity. Then your MySL may set the limit
on it own, to the value from my.cnf.
Unfortunately this is not working. We set value in my.cnf lesser than
value in mysql.service, but its only the value in mysql.service which rules.
May be an OS specific setting? We use Ubuntu 16.04.
It would be nice to tell systemd to let some services make their own rules
to gain what?

/etc/systemd/system/mysqld.service.d/ is *exactly* there to override
values machine specific and so there is no single reason to keep that
stuff in "my.cnf" as well as there is no reason to use mysqld_safe in a
systemd environemnt and all proper configured mysql/mariadb servers
using systemd capabilities where not affected from the shortly announced
root-exploit

it's a broken design that a application itself controls os ressources
Hajo Locke
2016-09-29 10:56:16 UTC
Permalink
Hello,
Post by Reindl Harald
Post by Hajo Locke
Hello,
Post by Tomasz Torcz
Post by Hajo Locke
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.
Set LimitNOFILE=infinity. Then your MySL may set the limit
on it own, to the value from my.cnf.
Unfortunately this is not working. We set value in my.cnf lesser than
value in mysql.service, but its only the value in mysql.service which rules.
May be an OS specific setting? We use Ubuntu 16.04.
It would be nice to tell systemd to let some services make their own rules
to gain what?
/etc/systemd/system/mysqld.service.d/ is *exactly* there to override
values machine specific and so there is no single reason to keep that
stuff in "my.cnf" as well as there is no reason to use mysqld_safe in
a systemd environemnt and all proper configured mysql/mariadb servers
using systemd capabilities where not affected from the shortly
announced root-exploit
it's a broken design that a application itself controls os ressources
thanks, for your help. this is answering some questions.
Post by Reindl Harald
_______________________________________________
systemd-devel mailing list
https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Thanks,
Hajo
Lennart Poettering
2016-10-07 10:37:09 UTC
Permalink
Post by Hajo Locke
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
--
Lennart Poettering, Red Hat
Continue reading on narkive:
Loading...