Create swap space on Linux

Create a 1 GB file to swap to (we have sufficient space on / on this machine. Use a different partition if necessary)

sudo dd if=/dev/zero of=/var/swapfile bs=1M count=1024

If you prefer 2GB swap, chose count=2048, 4GB: count=4096

Change permissions of swap file:

sudo chmod 0600 /var/swapfile

Set up swap file and enable it:

sudo mkswap /var/swapfile
sudo swapon /var/swapfile

You should see your swap space now:

thomas@machine:~$ free -m
              total       used       free     shared    buffers...

Run multiple Redis servers on Ubuntu

This is a way to run multiple redis server on one ubuntu server.

These steps you have to do only once:

  • Adjust init script

Change some Variables.
From this:

DAEMON_ARGS=/etc/redis/redis.conf
NAME=redis-server
DESC=redis-server
PIDFILE=/var/run/redis.pid

to this:

NAME=`basename ${0}`
DAEMON_ARGS=/etc/redis/${NAME}.conf
DESC=${NAME}
PIDFILE=/var/run/${NAME}.pid
  • Move redis configuration
    ^
    mv /etc/redis/redis.conf /etc/redis/redis-server.conf

These steps y...