Hello,
I ese a lot of variations of MySQLd / Percona XtraDB systemd service files on the internet and failed to deterine what the recommended one is, in order to ensure clean restarts of individual nodes in a three node cluster.
I am using the tar/binary release of the Percona XtraDB Cluster distribution. My current service file looks like this:
[Unit]
Description=Percona XtraDB Cluster Server
After=syslog.target network.target
[Service]
User=mysql
Group=mysql
Type=simple
PIDFile=/run/mysql/mysqld.pid
ExecStart=/opt/mysql/bin/mysqld --defaults-file=/etc/my.cnf -h /var/lib/mysql --socket=/run/mysql/mysql.sock --pid-file=/run/mysql/mysqld.pid
RuntimeDirectory=mysql
TimeoutSec=300
[Install]
WantedBy=multi-user.target
My main concern is not having a ExecStop= definition. I found the following ExecStop variations on the internet:
ExecStop=/usr/bin/kill $MAINPID
ExecStop=/opt/mysql/bin/mysqladmin shutdown
ExecStop=mysqld-systemd stop
But also the ExecStart= definition seems to leave room for alternation:
ExecStart=/opt/mysql/bin/mysqld
ExecStart=mysqld-systemd start
ExecStart=/opt/mysql/bin/mysqladmin
Another concern is my low timeout and a missing Restart= declaration. I had issues where a node crash would timeout during SST, and then un-cleanly try to restart over and over again.
I found an example service file by Percona debian-percona-xtradb-cluster-5.6/mysqld.service at master · percona/debian-percona-xtradb-cluster-5.6 · GitHub, but it does not seem to indicate a recommendation, and looks more like a boilerplate.
There also seem to be some variations of pepole using the rc-init scripts as commands inside the systemd service, which does not look right.
Does someone have a recommended MySQLd systemd service file, or, alternatively does someone know what the recommended way to gracefully shutdown and start a node (in an already bootstrapped cluster, not new nodes) on a systemd system is?
Thanks a lot!