简体   繁体   English

AWS:Mariadb 服务在 ec2 上随时自动停止

[英]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.我们正在使用 AWS 免费套餐帐户,我们在该帐户下创建了 ec2 实例,基本计划具有 1GB RAM。
We have our application on PHP and mysql. For this, we have setup LAMP on this EC2 instance.我们的应用程序位于 PHP 和 mysql。为此,我们在此 EC2 实例上设置了 LAMP。 All things are working fine as per expectation but sometimes mariadb service stopped unexpectedly anytime automatically.一切都按预期正常工作,但有时 mariadb 服务会随时自动意外停止。
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.我们已经搜索过这个问题,有人建议调整my.cnf文件中的innoDB memory以及调整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.最后,我们不得不重新启动我们的 ec2 实例以使其再次运行。

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.当服务器上没有可用的 memory 时,MariaDB 可能会被 OOM 杀手停止。

OOMKiller could stop MariaDB because it uses more memory than other processes, but the root cause of that issue might be Apache. OOMKiller 可以停止 MariaDB,因为它比其他进程使用更多的 memory,但该问题的根本原因可能是 Apache。

To assure that it is OOM look at log files.为确保它是 OOM,请查看日志文件。

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.如果是 OOMKiller,我建议您通过限制连接来限制 memory 为 Apache(多少个连接取决于 memory 使用您的 php 应用程序的数量,从最少 3-5 个并发连接开始尝试)并且不要更改 MySQL 的默认值。

To tune MySQL manually you could use - MySQLTuner要手动调整 MySQL,您可以使用 - MySQLTuner

To tune MySQL automatically you could use - Releem要自动调整 MySQL,您可以使用 - Releem

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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