[MDEV-427] Provide a systemd script for MariaDB Created: 2012-08-02 Updated: 2023-05-09 Resolved: 2015-10-15 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Packaging |
| Fix Version/s: | 10.1.8 |
| Type: | Task | Priority: | Critical |
| Reporter: | Colin Charles | Assignee: | Sergey Vojtovich |
| Resolution: | Fixed | Votes: | 11 |
| Labels: | packaging, systemd | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||
| Sprint: | 10.1.7-1, 10.1.7-2, 10.1.8-1, 10.1.8-3, 10.1.8-4 | ||||||||||||||||||||||||||||||||||||
| Description |
|
MySQL doesn't provide a systemd (http://www.freedesktop.org/wiki/Software/systemd/) script and thus distributions that are shipping systemd have to provide their own. Not many like this. So should we provide one inside the MariaDB package to be better for distributions than MySQL? Some references:
|
| Comments |
| Comment by AL13N [ 2012-08-02 ] | |||||||||||||||||||||||||||||||||||||||
|
see also http://svnweb.mageia.org/packages/cauldron/mariadb/current/SOURCES/mysqld.service?view=log for mysqld.service script from mageia | |||||||||||||||||||||||||||||||||||||||
| Comment by Otto Kekäläinen [ 2014-08-27 ] | |||||||||||||||||||||||||||||||||||||||
|
More links do downstream versions: OpenSUSE: https://build.opensuse.org/package/view_file/server:database/mariadb/mysql.service?expand=1 Fedora (uses two service files): Arch: https://projects.archlinux.org/svntogit/packages.git/tree/trunk/mariadb.service?h=packages/mariadb These are all different. They all even use different service names: mysql, mysqld, mariadb and mysql+mysql-compat. I'll do one for Debian once I figure out what the optimal service file should look like. | |||||||||||||||||||||||||||||||||||||||
| Comment by David Strauss [ 2014-08-28 ] | |||||||||||||||||||||||||||||||||||||||
|
It's possible to use one main service name and then configure an alias (in the units) as appropriate for each distro. | |||||||||||||||||||||||||||||||||||||||
| Comment by erkan yanar [ 2014-08-28 ] | |||||||||||||||||||||||||||||||||||||||
|
We should not waste time with broken examples.
This is broken. You use systemd to start the binary. | |||||||||||||||||||||||||||||||||||||||
| Comment by erkan yanar [ 2014-08-28 ] | |||||||||||||||||||||||||||||||||||||||
|
I had an look at the mariadb package from fedora20 and changed it
| |||||||||||||||||||||||||||||||||||||||
| Comment by David Strauss [ 2014-08-28 ] | |||||||||||||||||||||||||||||||||||||||
|
"Makes no real sense to wait for the mainpid we already control it" I disagree. With a Type=simple service, systemd considers the service fully running as soon as systemd starts running ExecStart. This is problematic if other services depend on MariaDB and need to run after its fully online. | |||||||||||||||||||||||||||||||||||||||
| Comment by AL13N [ 2014-08-28 ] | |||||||||||||||||||||||||||||||||||||||
|
for mageia, i would like to change this to not use mysqld_safe either... anyway, i'm open to suggestions... | |||||||||||||||||||||||||||||||||||||||
| Comment by Christian McHugh [ 2014-11-24 ] | |||||||||||||||||||||||||||||||||||||||
|
In our environment we have about 1000 mariadb/mysql databases. It takes a few minutes for everything to fully come up and be ready to serve connections. The redhat service file includes a ExecStartPost=/usr/libexec/mysqld-wait-ready $MAINPID bit where that script loops with "/usr/bin/mysqladmin --no-defaults --socket="$socketfile" --user=UNKNOWN_MYSQL_USER ping" until it can successfully connect (not successfully login, just connect). Something like that will probably be required to ensure the service is really up. | |||||||||||||||||||||||||||||||||||||||
| Comment by Otto Kekäläinen [ 2014-11-25 ] | |||||||||||||||||||||||||||||||||||||||
|
mchugh19 The old init scripts have a section that waits for service to come up (and also to stop at shutdown/restart) which uses the mysqld_status command. See http://anonscm.debian.org/cgit/pkg-mysql/mariadb-10.0.git/tree/debian/mariadb-server-10.0.mysql.init Others: http://0pointer.net/public/systemd-nluug-2014.pdf presents the systemd security features, which are encouraged (at least in Debian) to be used. | |||||||||||||||||||||||||||||||||||||||
| Comment by erkan yanar [ 2014-12-05 ] | |||||||||||||||||||||||||||||||||||||||
|
Hmm, | |||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2015-01-07 ] | |||||||||||||||||||||||||||||||||||||||
|
Avoided all deficiencies of type= {simple|forking} by using Type=Notify in | |||||||||||||||||||||||||||||||||||||||
| Comment by erkan yanar [ 2015-02-26 ] | |||||||||||||||||||||||||||||||||||||||
|
Oh notify is indeed a very nice opportunity. Making it not that "simple" anymore Making things more complex: | |||||||||||||||||||||||||||||||||||||||
| Comment by erkan yanar [ 2015-02-26 ] | |||||||||||||||||||||||||||||||||||||||
|
Btw: As with 10.1 and integrated Galera we need to take care of --wsrep-recover's job in mysqld_safe also | |||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2015-03-11 ] | |||||||||||||||||||||||||||||||||||||||
|
initialisations support-files/mariadb-systemd-start make it as late as possible, hopefully my.cnf files are populated by the time a user starts a service. wsrep-recover -looks like its something that should be moved into mysqld rather than running mysqld, extracting output and running mysqld again. https://github.com/MariaDB/server/pull/26 included systemd script | |||||||||||||||||||||||||||||||||||||||
| Comment by Nils Meyer [ 2015-07-16 ] | |||||||||||||||||||||||||||||||||||||||
|
This effectively prevents me from using MariaDB Galera in Debian Jessie since it's not possible to bootstrap the cluster without launching mysqld manually with the --wsrep-new-cluster, which will subsequently prevent managing the service through systemd. | |||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2015-07-17 ] | |||||||||||||||||||||||||||||||||||||||
|
nils.meyer yeh, perhaps having a type=oneshot or different service for that specific purpose that isn't part of the default. I'll see what I can make up. Quite a few things to consider for that however. I'll add them on top of the current pull request. | |||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2015-07-24 ] | |||||||||||||||||||||||||||||||||||||||
|
nils.meyer - | |||||||||||||||||||||||||||||||||||||||
| Comment by Julien Pivotto [ 2015-07-28 ] | |||||||||||||||||||||||||||||||||||||||
|
would it be possible to ship that for 10.0 as well? | |||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2015-07-28 ] | |||||||||||||||||||||||||||||||||||||||
|
We'd love to. But as it turned out, users don't like when we add new dependencies to our packages in a GA branch (yes, we've tried). And in these patches MariaDB is linked with libsystemd-daemon.so, so we'll have to add it as a dependency. We cannot do that. I see few options for 10.0:
What do you think we should do? Either way, I think we'll add systemd support in 10.1 first and then, possibly, backport parts of it to 10.0 | |||||||||||||||||||||||||||||||||||||||
| Comment by Guillaume Lefranc [ 2015-07-28 ] | |||||||||||||||||||||||||||||||||||||||
|
Sergei, I would suggest the third choice, aka minimal systemd support. This is the less intrusive, and to be honest, most people just need minimal support. Regards, | |||||||||||||||||||||||||||||||||||||||
| Comment by Otto Kekäläinen [ 2015-07-28 ] | |||||||||||||||||||||||||||||||||||||||
|
I agree with serg about being conservative in GA branches. Add well documented systemd scripts to 10.1 and downstream packagers can then choose themselves if they want to take the risk of backporting it somewhere, e.g. to new OS/Linux distro releases. |