在Windows环境搭建基于IPv6的redis集群

在Windows环境搭建基于IPv6的redis集群:

1.下载安装redis :GitHub路径如下:https://github.com/MSOpenTech/redis/releases/    下载zip格式

2.将下载的zip解压,通过配置文件三个启动不同的Redis实例

 A. 配置文件redis.7002.conf内容:

 

Port  7002 

loglevel notice    

logfile "D:/Redis/Logs/redis7002_log.txt"       

appendonly yes

appendfilename "appendonly.7002.aof"   

cluster-enabled yes                                    

cluster-config-file nodes.7002.conf

cluster-node-timeout 15000

cluster-slave-validity-factor 10

cluster-migration-barrier 1

cluster-require-full-coverage yes

 B.配置文件redis.7003.conf内容:

 

Port  7003

loglevel notice    

logfile "D:/Redis/Logs/redis7003_log.txt"       

appendonly yes

appendfilename "appendonly.7003.aof"   

cluster-enabled yes                                    

cluster-config-file nodes.7003.conf

cluster-node-timeout 15000

cluster-slave-validity-factor 10

cluster-migration-barrier 1

cluster-require-full-coverage yes

 

3.分别启动三个Redis服务

实用配置文件安装三个Redis   

D:/Redis/redis-server.exe --service-install D:/Redis/redis.6380.conf --service-name redis6380

启动服务D:/Redis/redis-server.exe --service-start --service-name Redis6380

 

  1. 下载安装ruby:http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.2.4-x64.exe

,然后在下载ruby环境下redis的驱动,https://rubygems.org/gems/redis/versions/3.2.2

 

下好驱动以后安装:

在cmd命令:gem install --local path_to_gem/filename.gem

5.下载Redis官方提供创建集群的ruby脚本:

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

如果一个页面,将它保存为redis-trib.rb

创建Redis集群:redis-trib.rb create --replicas 0 [0:0:0:0:0:0:0:1]:7002 

[0:0:0:0:0:0:0:1]:7003 [0:0:0:0:0:0:0:1]:7004

注意:IPv6的[0:0:0:0:0:0:0:1]相当于 IPv4的127.0.0.1。期间报错:ERR Slot 741 is already busy。参考:https://blog.csdn.net/qiushisoftware/article/details/78837855。如果还不能解决,查看自己创建集群的端口是否被占用,比如7002和17002都不可被占用。

6.输入yes 如果提示ok  则成功,报错会有error。

7.访问:redis-cli.exe -c -p 7002

 

你可能感兴趣的:(IPv6,Redis集群)