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 web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show snapshot

Change some Variables.
From this:


to this:

NAME=`basename ${0}`
  • 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/
    port 6379
    logfile /var/log/redis/redis-server.log
    dir /var/lib/redis

to this for example:

pidfile /var/run/
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)