简体   繁体   中英

AWS: Mariadb service stopped anytime automatically on ec2

We are using AWS free tier account under which we have created ec2 instance with basic plan having 1GB RAM.
We have our application on PHP and mysql. For this, we have setup LAMP on this EC2 instance. All things are working fine as per expectation but sometimes mariadb service stopped unexpectedly anytime automatically.
We have searched about this issue and some people are suggesting to adjust innoDB memory in my.cnf file as well as adjust connection related configurations in httpd.conf. We have tried all things but no success and still getting same issue. At last, we had to restart our ec2 instace to make working it again.

Can someone please let us know, what is going wrong there and what we need to do to fix this issue?
Thanks in advance

MariaDB could be stopped by OOM killer when there are no free memory on the server.

OOMKiller could stop MariaDB because it uses more memory than other processes, but the root cause of that issue might be Apache.

To assure that it is OOM look at log files.

If it was OOMKiller I suggest you to limit memory for Apache by limiting connections (how many connections depends on how much memory use your php app, try from minimum 3-5 concurrent connection) and don't change default of MySQL.

To tune MySQL manually you could use - MySQLTuner

To tune MySQL automatically you could use - Releem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM