MySQL server has gone away
message to ensure that mysql-server is running, that is automatically restarted after failure. This solution should be considered as temporary as it is in your best interest to investigate further your log files why your mysql server stopped and take appropriate steps to find long term solution. In the example below we use Debian Wheezy.First install puppet:
# wget http://apt.puppetlabs.com/puppetlabs-release-wheezy.deb # dpkg -i puppetlabs-release-wheezy.deb # apt-get update # apt-get install puppet
Create puppet manifest /root/mysql.pp. Feel free to use different location and file name:
# cat /root/mysql.pp service { 'mysql': ensure => running, }Next, create a crontab task to run every minute:
# crontab -eand add following line:
* * * * * /usr/bin/puppet apply /root/mysql.ppThe above will ensure that we check every minute whether mysql-server is running. If it is running we take no action and if its down puppet will start automatically.