• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

Configure MySQL Router to Auto Restart of Failure using systemd

by admin

The systemd unit file that ships with the MySQL Router 8.0 RPM’s will not automatically restart mysqlrouter on failure. It can be modifed to do so, though, by editing the file /usr/lib/systemd/system/mysqlrouter.service and adding this line:

Restart=on-failure

Put it right after the "ExecStart" line, so that the file ooks like this:

[Unit]
Description=MySQL Router
After=syslog.target
After=network.target

[Service]
Type=simple
User=mysqlrouter
Group=mysqlrouter

PIDFile=/var/run/mysqlrouter/mysqlrouter.pid

ExecStart=/usr/bin/mysqlrouter -c /etc/mysqlrouter/mysqlrouter.conf
Restart=on-failure

PrivateTmp=true

[Install]
WantedBy=multi-user.target

To make the changes take effect, systemd must be told to reload the unit files. From the command line:

# systemctl daemon-reload

Note that it will not restart the router on a normal shutdown, but only if it dies unexpectedly. So, kill -9 will make it restart, but a regular shutdown or kill with no flags will not.

Filed Under: CentOS/RHEL, CentOS/RHEL 7, CentOS/RHEL 8, Linux, mysql

Some more articles you might also be interested in …

  1. LVM error “WARNING: Inconsistent metadata found” – How to resolve in CentOS / RHEL
  2. Getting info with the vsish command (esxi only)
  3. manpath Command Examples in Linux
  4. pmap Command Examples in Linux
  5. CentOS / RHEL 6 : How to rebuild Initial Ramdisk Image
  6. Multi-Versioning in MySQL Database
  7. How to gather information on the MySQL 8 Roles and Privileges assigned to a user without using SHOW GRANTS
  8. CentOS / RHEL 5 : How to Configure kdump
  9. MySQL – How to undo (rollback) a set of SQL statements
  10. PAM password complexity and pam_cracklib credit system in CentOS/RHEL

You May Also Like

Primary Sidebar

Recent Posts

  • JavaFX ComboBox: Set a value to the combo box
  • Nginx load balancing
  • nginx 504 gateway time-out
  • Images preview with ngx_http_image_filter_module

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright