• 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. How to recover from deleted root entry in /etc/shadow and/or /etc/passwd files in CentOS / RHEL 6
  2. acme.sh –dns: Use a DNS-01 challenge to issue a TLS certificate (Command Examples)
  3. How to Change the Default Shell In Linux
  4. ansible-doc – Display information on modules installed in Ansible libraries
  5. resize2fs: commnd not found
  6. How to Enable Thin LVM Automatic Extension
  7. How to Rename KVM VM with virsh
  8. grub-install: command not found
  9. How to Check Btrfs FileSystem Usage and Perform Balancing
  10. “xfs_log_force: error 5 returned” – XFS Error (CentOS/RHEL 7)

You May Also Like

Primary Sidebar

Recent Posts

  • batch: Execute commands at a later time when the system load levels permit
  • bat: Print and concatenate files
  • bastet: Clone of the game Tetris in the terminal
  • bashmarks: Save and jump to commonly used directories using 1 character commands

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright