Redis master slave setup in single server

123 views
Skip to first unread message

rudr...@gmail.com

unread,
May 19, 2017, 10:42:28 AM5/19/17
to Redis DB
Hi 


I would like to bring up the  Redis-DB in Master Slave mode.

Is it possible to run both master and slave in single system?

Can somebody give me some information on the same.

Thanks,
Rudra


 

Jan-Erik Rediger

unread,
May 19, 2017, 10:51:19 AM5/19/17
to redi...@googlegroups.com
You can run multiple instances on a single server.
Just make sure each instance listens on a different port.
> --
> You received this message because you are subscribed to the Google Groups "Redis DB" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
> To post to this group, send email to redi...@googlegroups.com.
> Visit this group at https://groups.google.com/group/redis-db.
> For more options, visit https://groups.google.com/d/optout.

hva...@gmail.com

unread,
May 19, 2017, 12:04:41 PM5/19/17
to Redis DB
Your two Redis-server processes must use different PID files and different working directories, must listen for connections on different TCP ports, and one of them (the slave) will most likely have a 'slaveof' parameter in its config file.  The pid file location is the 'pidfile' parameter, the working directory is the 'dir' parameter, and the TCP port is the 'port' parameter in the config file.

This means your two processes must have have different config files.  Different config files on Linux/Unix servers means a different command to launch the processes (the config file is specified as an argument to the command that invokes redis-server), so you need two start scripts or systemd config files.

I have no experience with Windows server, so I don't know how to do it on Windows (or even if it's possible).

NIKHIL NARAYAN Khetan

unread,
May 20, 2017, 2:55:44 AM5/20/17
to Redis DB
Hi Rudra,

You can setup both the master and slave in single server by running the instances on different ports and having different pidfiles.

However, I would recommend having them on different server to guarantee availability of data if a machine goes down.

Regards,
Nikhil
Reply all
Reply to author
Forward
0 new messages