Ubuntu – How to configure another instance of redis on ubuntu

installationredisserviceUbuntu

I basically want to have 2 instances of redis on Ubuntu. I looked at /etc/init.d/redis-server script and tried to create a new one (redis-server-dev) pointing to another config file (new port etc) but it didn't seem to work.

What is the correct procedure?

Thanks

Best Answer

  • Create a new config file /etc/redis/redis-new.conf (copied from redis.conf) and change these fields in the new config
    • pidfile
    • port
    • logfile
    • dir (for the default db)
  • Create a new file /etc/init.d/redis-server-new (copied from the file redis-server) and change these fields in the new file
    • name
    • pidfile (same as in the config file in step 1)
    • deamon_args (the path to the config file in step 1).
  • Create the needed directorymkdir /var/lib/redis-new (and give it the proper rights chown redis:redis /var/lib/redis-new)
  • Make the new file executable: chmod +x /etc/init.d/redis-server-new
  • Register the new deamon: update-rc.d redis-server-new defaults
Related Topic