AWS micro instances & mysqld deadlock
If you’re running mysql daemon on an AWS micro instance type AMI like me, you must already have undergone mysqld deadlocks day by day. I guess, to move local mysql db to AWS RDS is the best solution in order to avoid this circumstance.
Creating a swap space is one of the solutions but you may have a limited storage on micro instances.Another solution would be to restart mysqld when it stops by cron jobs 🙂
Here is my bash script:
[ec2-user@ip-xyz-xyz-xyz-xyz filestores]$ more mybashscript
if [[ ! “$(/sbin/service mysqld status)” =~ “start/running” ]]
/sbin/service mysqld start
Don’t forget to give required permission for your bash file.
chmod +x /home/ec2-user/filestores/mybashscript
And here is crontab (root crontab file!)You can access root crontab file by typing sudo crontab -e command
*/1 * * * * /home/ec2-user/filestores/mybashscript –> Bash will run in every 1 minute.
That’s all, just give it a try. You can find different bash script on the Internet.
Wish you good and prosperity
Have a nice day.