Read more

Run multiple Redis servers on Ubuntu

Kim Klotz
April 12, 2012Software engineer at makandra GmbH

This was done with an older version of Ubuntu and probably wont work anymore.

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

These steps you have to do only once:

  • Adjust init script
Illustration UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
Read more Show archive.org snapshot

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 you have to do for every new redis server:

  • Copy configuration:
    ^
    cp /etc/redis/redis-server.conf /etc/redis/redis-server2.conf

  • In the /etc/redis/redis-server2.conf you have to change at least this options:
    ^
    pidfile /var/run/redis-server.pid
    port 6379
    logfile /var/log/redis/redis-server.log
    dir /var/lib/redis

to this for example:

pidfile /var/run/redis-server2.pid
port 6380
logfile /var/log/redis/redis-server2.log
dir /var/lib/redis2
  • Symlink the init script:
    ^
    ln -s /etc/init.d/redis-server /etc/init.d/redis-server2

  • Create working directory:
    ^
    mkdir /var/lib/redis2; chown redis.redis /var/lib/redis2;

  • Start server and add init script to system startup
    ^
    /etc/init.d/redis-server2 start
    update-rc.d redis-server2 defaults

Kim Klotz
April 12, 2012Software engineer at makandra GmbH
Posted by Kim Klotz to makandra Operations (2012-04-12 18:22)