31 cards
View
Posted over 6 years ago. Visible to the public. Deprecated.

Run multiple Redis servers on Ubuntu

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

Change some Variables.
From this:

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

to this:

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

These steps you have to do for every new redis server:

  • Copy configuration:
Copy
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:
Copy
pidfile /var/run/redis-server.pid port 6379 logfile /var/log/redis/redis-server.log dir /var/lib/redis

to this for example:

Copy
pidfile /var/run/redis-server2.pid port 6380 logfile /var/log/redis/redis-server2.log dir /var/lib/redis2
  • Symlink the init script:
Copy
ln -s /etc/init.d/redis-server /etc/init.d/redis-server2
  • Create working directory:
Copy
mkdir /var/lib/redis2; chown redis.redis /var/lib/redis2;
  • Start server and add init script to system startup
Copy
/etc/init.d/redis-server2 start update-rc.d redis-server2 defaults

Owner of this card:

Avatar
Kim Jahn
Last edit:
about 1 year ago
by Kim Jahn
Keywords:
ops
This website uses cookies to improve usability and analyze traffic.
Accept or learn more