Like me if you are using amazon free tier to host your websites then you must have learnt that hosting any decent traffic website on the amount of RAM ec2 micro provides is very risky. specially mysql keep on eating the RAM. I use amazon RDS it also comes under amazon free tier. But if you like to keep you mysql instance on your ec2 instance than you can add some swap space to it.
Here is how to add swap space to amazon ec2 instance in step by step guide.
You need to be root to perform these commands. To do this issue this command
$ sudo su
Type the following command with count being equal to the desired block size:
dd if=/dev/zero of=/swapfile bs=1M count=1024
Setup the swap file with the command:
mkswap /swapfile
To enable the swap file immediately but not automatically at boot time:
swapon /swapfile
To enable it at the boot time, add the following entry into /etc/fstab:
/swapfile swap swap defaults 0 0
Remember last line is not a command. You have to add this line to the file /etc/fstab.
You can do this by
nano /etc/fstab
then paste above line right clicking.
hit control+x
type ‘y’
hit enter.
No comments:
Post a Comment