Setting up a Second Instance of Redis

From Brian Nelson Ramblings
Revision as of 17:32, 24 December 2013 by Brian (Talk | contribs) (Created page with "==Add a second instance of Redis== Redis is single-threaded so it’s performance peaks when it uses one full CPU core. On a multi-core machine (every machine these days) you...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Add a second instance of Redis

Redis is single-threaded so it’s performance peaks when it uses one full CPU core. On a multi-core machine (every machine these days) your peak performance with Redis will be higher if you can use multiple cores. Also, there will be no waiting between different processes. E.g. while one process may be fetching the config, another would be waiting to load a session and another would be waiting to load a FPC record. By having each on a separate core you have much higher peak performance and less contention.

cp /etc/redis.conf /etc/redis2.conf && cp /etc/init.d/redis /etc/init.d/redis2

Change

vim /etc/init.d/redis2
pidfile="/var/run/redis/redis.pid" to pidfile="/var/run/redis/redis2.pid"
REDIS_CONFIG="/etc/redis.conf" to REDIS_CONFIG="/etc/redis2.conf"

Change

vim /etc/redis2.conf
port 6379 to port 6380
unixsocket /tmp/redis.sock to unixsocket /tmp/redis2.sock
service redis2 start

Let also make this instance start up on boot

chkconfig redis2 on

Now verify its set to start at boot

chkconfig --list redis2
redis2          0:off   1:off   2:on    3:on    4:on    5:on    6:off