Windows下redis cluster 配置

复制6份redis,并修改各个配置文件(redis.windows.conf)

cluster1配置
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配置
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配置
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配置
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配置
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配置
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

注册6个redis服务到本地

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

注册成功后启动全部服务

安装ruby

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

安装完成之后进入cmd

依次输入:ruby -v和gem -v ,确认是否正确安装

然后输入gem sources查看源

接着添加源,防止原来的源被墙,gem sources -a https://gems.ruby-china.com/

安装redis依赖,gem install redis

下载Redis官方提供的创建Redis集群的ruby脚本文件redis-trib.rb,路径如下:

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

保存到本地,建议redis目录下,命名为redis-trib.rb

cmd下切换到redis-trib.rb目录下,创建集群,1代表集群中从服务的数量,一共6个服务,最后会自动配置成3主3从

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

接着输入yes确认方案   master(6111,6112,6113) slave(6114,6115,6116)

到这儿,简单的3主3从集群已经部署完毕

具体的cluster其他命令可以自己去找

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值