第一步
安装Ruby环境,安装:rubyinstaller-2.3.0-x64.exe
http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.2.4-x64.exe
这里将Ruby安装在 C:\Ruby22-x64
目录下。
https://github.com/MSOpenTech/redis/releases/download/win-3.0.501/Redis-x64-3.0.501.msi
这里将Redis安装在 C:\Redis
目录下,或者到https://github.com/MSOpenTech/redis/releases 下载绿色的安装包;
解压Redis 3.0绿色安装包压到指定目录
安装好redis window 以及ruby。
redis版本必须在3.0以上
2、配置集群文件
新建7001,7002,7003,7004,7005,7006六个文件夹
配置说明:
7001,7002,7003,7004,7005,7006中三个是Master 三个是Slaver
分别在6个目录中新建6个配置文件例:redis.7001.conf
配置文件内容:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
port 7001
appendonly
yes
appendfilename
"appendonly.7001.aof"
cluster-enabled
yes
cluster-config-
file
nodes-7001.conf
cluster-node-timeout 15000
cluster-slave-validity-factor 10
cluster-
|
第三步
启动redis 端口
使用CMD进入到控制台,然后进入到Redis的根目录下,运行Redis-server.exe命令注册Redis服务并启动Redis,如下:
例如 cmd redis目录
redis-service.exe redis.7000.conf
redis-service.exe redis.7001.conf
redis-service.exe redis.7002.conf
redis-service.exe redis.7003.conf
redis-service.exe redis.7004.conf
redis-service.exe redis.7005.conf
第四步 创建集群
进入ruby 目录 找到start command 打开
记得改变ruby 源
gem sources --add http://gems.ruby-china.org/ --remove https://rubygems.org/
gem
install
redis
可以参考https://ruby.taobao.org/
最后可以gem sources 查看是否成功
第四步 启动集群
redis-trib.rb create --replicas 1 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005 127.0.0.1:7006
如果失败 可以重装 ruby试试。