mysql,  ghost,  ubuntu

Memory issues running Ghost with MySQL on tiny machines.

Unfortunately stabilizing MySQL on our tiny server was not simple and in fact the only thing that helped was a SWAP file.

Memory issues running Ghost with MySQL on tiny machines.

We have recently upgraded our Ghost servers from 0.11.11 to 1.8.4 and our blogs started crashing randomly.

Since we installed Ghost using its CLI tool it was easy to see what el problema was by running: ghost ls to get the name of the blog and then ghost log blog_name to see that the error was ECONNREFUSED 127.0.0.1:3306 (I wish they would have come up with something better).

Unfortunately stabilizing MySQL on our tiny server was not simple and in fact the only thing that helped was a SWAP file.

Here is how to create it on Ubuntu (hosted by DigitalOcean, thanks to juanjo2988).

sudo dd if=/dev/zero of=/swap.dat bs=1024 count=512k
sudo mkswap /swap.dat
sudo swapon /swap.dat

and adding the following row to the fstab file:

sudo vi /etc/fstab
________________________________________________

/swap.dat      none    swap    sw      0       0

To check that the file was create we can run: sudo swapon -s

An additional and in our case optional step would be to update MySQL config file (ususaly my.cnf) with innodb_buffer_pool_size=64M and reload it sudo service mysqld reload

Subscribe to The infinite monkey theorem

Get the latest posts delivered right to your inbox