Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ChuntaoLu/015e89b00039acd58c9d to your computer and use it in GitHub Desktop.
Save ChuntaoLu/015e89b00039acd58c9d to your computer and use it in GitHub Desktop.
configure multiple redis servers
  • create a new redis .conf file
$ cp /etc/redis/6379.conf /etc/redis/6380.conf
  • edit /etc/redis/6380.conf, illustrated as below
...
#modify pidfile
#pidfile /var/run/redis/redis_6379.pid
pidfile /var/run/redis/redis_6380.pid

...
#modify port
#port 6379
port 6380

...
#modify logfile
#logfile /var/log/redis/redis_6379.log
logfile /var/log/redis/redis_6380.log

...
#modify vm-swap-file
#vm-swap-file /tmp/redis_6379.swap
vm-swap-file /tmp/redis_6380.swap
...

*copy /var/lib/redis/6379

cp -r /var/lib/redis/6379 /var/lib/redis/6380
  • copy init script
$ cp /etc/init.d/redis_6379 /etc/init.d/redis_6380
  • edit the new init script
...

#pidfile="/var/run/redis/redis_6379.pid"
pidfile="/var/run/redis/redis_6380.pid"

...

#REDIS_CONFIG="/etc/redis/6379.conf"
REDIS_CONFIG="/etc/redis/6380.conf"

...
  • start redis_6380 server
$ sudo redis_server /etc/redis/6380.conf
  • start redis-cli
$ redis-cli -p 6380
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment