littlebizzy / slickstack

Lightning-fast WordPress on Nginx
https://slickstack.io
GNU General Public License v3.0
624 stars 113 forks source link

Auto restart MySQL service if it went down #182

Open bari86 opened 1 year ago

bari86 commented 1 year ago

Sometimes I see that MySQL service went down and then stays down. Would be good if there is something to monitor the service and restart it should it went down for 1 minute? I believe cPanel use something like this where if ever MySQL service is down, it can auto-restart it automatically.

jessuppi commented 1 year ago

Thanks for posting @bari86

Interestingly right after you mentioned this, I had a client contact me who is using SlickStack on an older Ubuntu 20.04 server saying his website was crashed... the error log was full of Redis object cache related errors.

I have to assume whatever he experienced is likely the same as you.

I'm going to open a new Issue to investigate that further, but the "quick fix" is probably migrating your site to a brand new build on Ubuntu 22.04 which is incredibly stable for us.

About auto-restarting MySQL it's a great idea and something we used to have (kinda) with Monit, but after we stopped bundling monitoring apps there hasn't been any further attempt at auto-restarting services.

hj-collab commented 1 year ago

@jessuppi You can add the below line to make redis / mysql restart always when it runs out of memory. Ofcourse this won't restart for configuration errors. Override the systemd service file by creating an override file else update will override your change.

[Service]
Restart=always