Mysql falling due to lack of memory

Asked

Viewed 2,288 times

6

I have a dedicated server Linux Ubuntu 12.04 LTS with Mysql/Apache/Wordpress, Only since he has only 1Gb of RAM, sometimes he falls for lack of memory. No syslog marks with the message

Out of memory: Kill process XXXXX (mysqld) score XXXXXX or Sacrifice Child

and then

mysql respawning Too fast, stopped

Is there any solution for the Mysql daemon to keep trying to get back, but at longer intervals (like 5 minutes)?

** Updating:

/etc/mysql/my.cnf: http://pastebin.com/Vy19ZZTR

  • You can paste what value is to innodb_buffer_pool_size in your file/etc/mysql/my.cnf?

  • In fact it would be nice to paste a link to your settings from /etc/mysql/my.cnf. It is possible that the reason for mysql not being able to restart is in this file.

  • I updated with Mysql configuration

1 answer

5


Check the maximum amount of memory your server could theoretically use

Use the script MySQLTuner, available in https://github.com/major/MySQLTuner-perl, and follow his recommendations. He will at first already tell you how much memory your database could use in a time of stress. Make sure it is smaller than you actually have, or at least check if it has swap enabled.

SWAP

In addition to setting up your Mysql to use less memory, something that should always be done on small virtual machines is to create SWAP. A database running in SWAP is not a good idea, but at least its application will not stop for lack of memory.

In https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04 explains how to do this process with Centos.

Execute the command

sudo swapon -s

and see if it returns a value with SWAP size. If it does not return, it must be created.

  • Great tip, I’m testing to see if it solves.

  • 1

    Swap worked, the server never crashed again, thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.