Symptoms
The cPanel & WHM software reports MySQL is down:
# /usr/local/cpanel/scripts/restartsrv_mysql --status
(XID l35tte) The “mysql” service is down.
But mysqld_safe is running:
# ps fauxww | grep mysq[l]
root 1030 0.0 0.1 113632 1592 ? S 12:21 0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/host.hostname.tld.pid
mysql 1134 0.0 8.7 1305384 88428 ? Sl 12:21 0:01 \_ /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/host.hostname.tld.err --open-files-limit=10000 --pid-file=/var/lib/mysql/$hostname.pid
Description
MariaDB versions below 10.4.4 and after 10.1.17 on EL7 systems are subject to a race condition between systemd and the init script they provide. This means that upon reboot, sometimes MySQL gets restarted with mysqld_safe when it never should.
The following upstream bug cases are related:
https://jira.mariadb.org/browse/MDEV-10797
https://jira.mariadb.org/browse/MDEV-11046
Workaround
Make sure that MariaDB is enabled with this command:
systemctl enable mariadb
Example:
# systemctl enable mariadb
Created symlink from /etc/systemd/system/mysql.service to /usr/lib/systemd/system/mariadb.service.
Created symlink from /etc/systemd/system/mysqld.service to /usr/lib/systemd/system/mariadb.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
Stop MySQL, then start it using the restartsrv script:
/usr/local/cpanel/scripts/restartsrv_mysql --stop
/usr/local/cpanel/scripts/restartsrv_mysql --start
Comments
0 comments
Article is closed for comments.