redis cluster configuration under Windows

Keywords: Redis Windows Ruby github

Copy 6 copies of redis and modify each configuration file (redis.windows.conf)

cluster1 To configure
bind 192.168.1.223
port 6111      
loglevel notice    
logfile "D:/develop/redisClusterMS/Redis -clu -1/redis6111_log.txt"       
appendonly yes
appendfilename "appendonly.6111.aof"   
cluster-enabled yes                                    
cluster-config-file nodes.6111.conf
cluster-node-timeout 15000
cluster-slave-validity-factor 10
cluster-migration-barrier 1
cluster-require-full-coverage yes

cluster2 To configure
bind 192.168.1.223
port 6112      
loglevel notice    
logfile "D:/develop/redisClusterMS/Redis -clu -2/redis6112_log.txt"       
appendonly yes
appendfilename "appendonly.6112.aof"   
cluster-enabled yes                                    
cluster-config-file nodes.6112.conf
cluster-node-timeout 15000
cluster-slave-validity-factor 10
cluster-migration-barrier 1
cluster-require-full-coverage yes

cluster3 To configure
bind 192.168.1.223
port 6113      
loglevel notice    
logfile "D:/develop/redisClusterMS/Redis -clu -3/redis6113_log.txt"       
appendonly yes
appendfilename "appendonly.6113.aof"   
cluster-enabled yes                                    
cluster-config-file nodes.6113.conf
cluster-node-timeout 15000
cluster-slave-validity-factor 10
cluster-migration-barrier 1
cluster-require-full-coverage yes

cluster4 To configure
bind 192.168.1.223
port 6114      
loglevel notice    
logfile "D:/develop/redisClusterMS/Redis -clu -4/redis6114_log.txt"       
appendonly yes
appendfilename "appendonly.6114.aof"   
cluster-enabled yes                                    
cluster-config-file nodes.6114.conf
cluster-node-timeout 15000
cluster-slave-validity-factor 10
cluster-migration-barrier 1
cluster-require-full-coverage yes

cluster5 To configure
bind 192.168.1.223
port 6115      
loglevel notice    
logfile "D:/develop/redisClusterMS/Redis -clu -5/redis6115_log.txt"       
appendonly yes
appendfilename "appendonly.6115.aof"   
cluster-enabled yes                                    
cluster-config-file nodes.6115.conf
cluster-node-timeout 15000
cluster-slave-validity-factor 10
cluster-migration-barrier 1
cluster-require-full-coverage yes

cluster6 To configure
bind 192.168.1.223
port 6116      
loglevel notice    
logfile "D:/develop/redisClusterMS/Redis -clu -6/redis6116_log.txt"       
appendonly yes
appendfilename "appendonly.6116.aof"   
cluster-enabled yes                                    
cluster-config-file nodes.6116.conf
cluster-node-timeout 15000
cluster-slave-validity-factor 10
cluster-migration-barrier 1
cluster-require-full-coverage yes

Register 6 redis services to local

D:\develop\redisClusterMS\Redis -clu -1>redis-server.exe --service-install redis.windows.conf --service-name redis6111
D:\develop\redisClusterMS\Redis -clu -2>redis-server.exe --service-install redis.windows.conf --service-name redis6112
D:\develop\redisClusterMS\Redis -clu -3>redis-server.exe --service-install redis.windows.conf --service-name redis6113
D:\develop\redisClusterMS\Redis -clu -4>redis-server.exe --service-install redis.windows.conf --service-name redis6114
D:\develop\redisClusterMS\Redis -clu -5>redis-server.exe --service-install redis.windows.conf --service-name redis6115
D:\develop\redisClusterMS\Redis -clu -6>redis-server.exe --service-install redis.windows.conf --service-name redis6116

Start all services after successful registration

Install ruby

https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-2.5.1-2/rubyinstaller-2.5.1-2-x64.exe

Enter cmd after installation

Enter ruby-v and gem-v to confirm whether they are installed correctly

Then enter gem sources to view the sources

Then add the source to prevent the original source from being walled. gem sources -a https://gems.ruby-china.com/

gem install redis

Download redis-trib.rb, a ruby script file officially provided by Redis to create a Redis cluster. The path is as follows:

    https://raw.githubusercontent.com/MSOpenTech/redis/3.0/src/redis-trib.rb

Save it locally. It is recommended to name it redis-trib.rb in the redis directory

Switch to the redis-trib.rb directory under cmd, create a cluster, 1 represents the number of slave services in the cluster, a total of 6 services, and finally will be automatically configured as 3 primary and 3 secondary

redis-trib.rb create --replicas 1 192.168.1.223:6111 192.168.1.223:6112 192.168.1.223:6113 192.168.1.223:6114 192.168.1.223:6115 192.168.1.223:6116

Then enter yes to confirm master (611161126113) slave (611461156116)

So far, a simple 3-master 3-slave cluster has been deployed

Specific cluster other commands can be found by yourself

Posted by ac1dsp3ctrum on Fri, 03 Jan 2020 00:09:40 -0800