Hi,
I am running a wordpress installation on a $20 droplet (2gb | 2 core ), which i thought would be more than enough to run a wordpress site with 300 hits a day.
I keep getting the ‘Error establishing database connection’, and i have to keep restarting the server.
Is it possible to find out what is causing the memory errors, and how much memory i need?
I’ve ran a view commands and i can see that:
/var/log/mysql/error.log:151111 8:38:10 InnoDB: Fatal error: cannot allocate memory for the buffer pool
/var/log/mysql/error.log:151111 8:38:11 InnoDB: Fatal error: cannot allocate memory for the buffer pool
Thanks in advance for your help.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
@mosaic - The free -m command will output something such as:
total used free shared buffers cached
Mem: 2000 1982 18 0 95 1666
-/+ buffers/cache: 220 1780
Swap: 0 0 0
What this means is that I have 2000MB of RAM, I’ve “used” 1982MB, of which 1666MB is cached and 95MB is buffer.
You can also use
free -mh
for an easier to read and pre-converted output which is converted to MB & GB instead of the default shown above, such as:
total used free shared buffers cached
Mem: 2.0G 1.9G 20M 632K 88M 1.6G
-/+ buffers/cache: 210M 1.7G
Swap: 0B 0B 0B
What this does is simply tell you how much RAM you’re currently utilizing as of command execution.
–
That said, the free -m or free -mh command isn’t going to tell you where your problem is. You really need to look at RAM usage by process, specifically MySQL, Apache/NGINX, PHP etc.
To start, I’d advise downloading, installing and running MySQL Tuner (installation and usage details are on the main page of the site). This needs to be done as the root user from the command line interface (CLI). Once executed, it’ll provide you with a plethora of information that can be used to diagnose RAM usage by MySQL as well as overall performance.
If you would, run MySQL Tuner, copy & paste the results in a PasteBin and post the link to the PasteBin here. I’ll be more than happy to look over it for you.
It’ll also be helpful to see what the top output is. You can do this by running:
top
And then pressing shift m followed by c on your keyboard. That’ll sort the processes by RAM usage and expand the commands / processes. You can then select (copy) and paste that in to the PasteBin as well.
–
To expand on the “used” RAM above, simply because I’ve “used” 1.9GB out of the 2GB I’ve been allocated does not mean that I’ve used that much. The 1.6GB’s from the cache column is included in that 1.9GB’s, so my actual usage is only ~300MB. The other 1.3GB is cached and used by current processes until they are either stopped, killed or restarted.
This particular Droplet does not have a swap allocation, which is why swap reports all 0’s.
I had the same issue, identical droplet size. It was an XML-RPC attack (Wordpress related).
Check this article for help: How To Protect WordPress from XML-RPC Attacks on Ubuntu 14.04
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.