• 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. “-bash: route: command not found” on CentOS/RHEL 7
  2. CentOS / RHEL 7 : How to disable all tty consoles and enable only 1
  3. gpasswd Command Examples in Linux
  4. Downloading RPM Packages with dependencies [ yumdownloader Vs yum-downloadonly Vs repoquery]
  5. How to fix the error “host key verification failed”
  6. ClusterSSH(cssh) – Manage Multiple SSH Sessions on Linux
  7. CentOS / RHEL : How to add new swap partition
  8. Linux OS Service ‘acpid’
  9. Linux / UNIX : How to create extended partition using fdisk
  10. How to Configure YUM to connect to Oracle Public Repository in Oracle Enterprise Linux

You May Also Like

Primary Sidebar

Recent Posts

  • netselect-apt Command Examples in Linux
  • netselect-apt: command not found
  • nethogs Command Examples in Linux
  • nethogs: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright