自动重启MySQL时的Ubuntu在EC2上运行时内存不足,例如微杀死它 [英] Restart Mysql automatically when ubuntu on EC2 micro instance kills it when running out of memory

查看:517
本文介绍了自动重启MySQL时的Ubuntu在EC2上运行时内存不足,例如微杀死它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在系统内存用完,Ubuntu的12.04杀死MySQL进程:

When the system runs out of memory, ubuntu 12.04 kills the mysql process:

Out of memory: Kill process 17074 (mysqld) score 146 or sacrifice child

所以杀的过程中结束。 这发生在服务器负载高峰和Apache主要是因为越来越野,吃剩下的可用内存。可能的方法可以是:

So the process ends up killed. This happens at peaks of server load and mainly because of apache getting wild and eating the remaining available memory. Possible approaches could be:

  • 更改某个莫名其妙的mysql的优先级,所以它不是杀死(可能是一个坏的修复的东西都不会被杀死)
  • 监控MySQL的状态,每当它杀了自动重启(一个我在想,但不知道如何做到这一点)。

你怎么看呢?

推荐答案

突然终止数据库服务器是一个非常严重的崩溃。你需要避免这种在生产系统中,因为它可能无法重新启动干净。

Abrupt termination of a database server is a very serious crash. You need to avoid this in a production system, because it may not restart cleanly.

数据库服务器是一个共享资源,并应几乎从来没有停止在生产计划外的方式。这应该引起非计划终止的唯一事情是灾难性的硬件或电源故障。大多数适当配置生产数据库服务器有一个意外的终止每隔十年或更频繁一次。认真。

The database server is a shared resource, and should almost never terminate in an unplanned fashion in production. The only thing that should cause unplanned termination is a catastrophic hardware or power failure. Most properly configured production data base servers have an unplanned termination once every ten years or less frequently. Seriously.

怎么办?

修正你的Apache配置。限制工作线程的数量和处理它可以使用,所以它不能像脱缰的野马。学习如何做到这一点。这一点很重要。在这里看到:<一href="http://httpd.apache.org/docs/current/mod/mpm_common.html#maxrequestworkers">http://httpd.apache.org/docs/current/mod/mpm_common.html#maxrequestworkers

Fix your apache configuration. Limit the number of worker threads and processes it can use, so it can't run wild. Learn how to do this. It's vital. See here: http://httpd.apache.org/docs/current/mod/mpm_common.html#maxrequestworkers

修正在你的web应用程序,是造成你的Apache撒野的缺陷。

Fix the defects in your web app that are causing your apache to run wild.

如果可以的话,将你的mysqld服务器以Apache的不同的服务器上,因此两者不争用相同的硬件资源。

If you can, move your mysqld server to a different server machine from apache, so the two don't contend for the same hardware resources.

配置您的mysqld来限制连接,将接受来自Apache的工作线程或其他客户端的数量。你的web应用程序可能处理这样一个工作线程需要等待连接的情况。看这里。 <一href="http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_max_connections">http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_max_connections

Configure your mysqld to limit the number of connections it will accept from apache worker threads or other clients. Your web app probably handles the situation where a worker thread needs to wait for a connection. See here. http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_max_connections

您在一个EC2实例微?你需要做一些认真的调整。在这里看到:<一href="http://ubuntuforums.org/showthread.php?t=1979049">http://ubuntuforums.org/showthread.php?t=1979049

Are you on an EC2 micro instance? You need to do some serious tuning. See here: http://ubuntuforums.org/showthread.php?t=1979049

这篇关于自动重启MySQL时的Ubuntu在EC2上运行时内存不足,例如微杀死它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆