redis on windows cluster setup redis on windows cluster setup windows windows

redis on windows cluster setup


You can follow the Redis Cluster Tutorial and to create the cluster you can use the redis-trib.rb ruby script, for which you need to install Ruby for Windows.

For example:

> C:\Ruby22\Bin\ruby.exe redis-trib.rb create --replicas 1 192.168.1.1:7000 192.168.1.1:7001 192.168.1.1:7002 192.168.1.1:7003 192.168.1.1:7004 192.168.1.1:7005


Did not have the option to install Ruby on Windows but found the manual steps worked for me. The Ruby script seems to do a lot of checking stuff is setup correctly and is the preferred setup route. So Beware, here be dragons.

Set each node to run in Cluster mode. Edit the redis.windows-service.conf file and uncomment

cluster-enabled yescluster-config-file nodes-6379.confcluster-node-timeout 15000

restart the service.

Run a powershell window and change to the Redis installed folder and start the redis-cli. e.g.

cd "C:\Program Files\Redis".\redis-cli.exe

Now you can join other nodes. Run CLUSTER MEET IPADDRESS PORT for each of the other nodes, than the instance you happen to be on. e.g.

CLUSTER MEET 10.10.0.2 6379

After a few seconds running

CLUSTER NODES

Should list all the nodes connected, but all will be set as MASTER.

On each of the other nodes, run CLUSTER REPLICATE MASTERNODEID. Where MASTERNODEID is the hash-looking value next the node declared "myself" on your master when running CLUSTER NODES. e.g.

CLUSTER REPLICATE b7c767ab3ab7c4a926ac2fed937cf140b96764a7

Now allocate slots to each Master. My setup has three instances, only one master.

for ($slot=0;$slot -le 16383;$slot++) {    .\redis-cli.exe -h REDMST CLUSTER ADDSLOTS $slot}

Reconnect with redis-cli and try and save data. e.g.

SET foo barOKGET foo"bar"

Phew! Got most this from reading https://www.javacodegeeks.com/2015/09/redis-clustering.html#InstallingRedis which is not Windows specific.


for windows version:

open the command window then type below command

C:\ProgramFiles\redis>FOR /L %i IN (0,1,16383) DO ( redis-cli.exe -p **6380** CLUSTER ADDSLOTS %i )

6380 is port of master node.