Auto Restart Mysql / MariaDB Using Monit In Ubuntu With EasyEngine

Install Monit

$ sudo apt-get install monit

Configure Monit to Monitor MySQL / MariaDB

$ sudo nano /etc/monit/conf.d/mysql
check process mysql with pidfile /run/mysqld/mysqld.pid
    start program = "/usr/sbin/service mysql start" with timeout 60 seconds
    stop program  = "/usr/sbin/service mysql stop"
    if failed unixsocket /var/run/mysqld/mysqld.sock then restart
$ sudo service monit reload

Enable Monit service at boot time

$ sudo systemctl enable monit

 

About the author

admin

View all posts

Leave a Reply

Your email address will not be published. Required fields are marked *