一、redis的下载安装:
(1)下载Redis-x64-3.2.100地址:https://github.com/MicrosoftArchive/redis/releases
(2)安装后文件如下:
二、更改配置文件:
(1)复制redis.windows.conf配置6份,更名如下:
(2)修改配置文件,以redis.windows-7000.conf为例,其余几份内容一样,只需要修改7000为对应端口:
port 7000 loglevel notice logfile "D:/Redis_dir/Logs/redis7000_log.txt" appendonly yes appendfilename "appendonly.7000.aof" cluster-enabled yes cluster-config-file nodes.7000.conf cluster-node-timeout 15000 cluster-slave-validity-factor 10 cluster-migration-barrier 1 cluster-require-full-coverage yes
三、创建redis服务并启动:
(1)创建安装redis服务和启动redis服务的bat文件,以redis-7000install.bat和redis-7000start.bat为例,类似上面更改端口号:
# redis-7000install.bat D:/Redis_dir/redis-server.exe --service-install D:/Redis_dir/redis.windows-7000.conf --service-name redis7000 # redis-7000start.bat D:/Redis_dir/redis-server.exe --service-start --service-name Redis7000 # 注意写绝对路径
(2)安装redis服务:
cd D:\Redis_dir redis-7000install.bat redis-7001install.bat redis-7002install.bat redis-7003install.bat redis-7004install.bat redis-7005install.bat
(3)启动redis服务:
redis-7000start.bat redis-7001start.bat redis-7002start.bat redis-7003start.bat redis-7004start.bat redis-7005start.bat
(4)查看服务:
四、Ruby及redis驱动下载安装
(1)安装Ruby(创建redis集群工具redis-trib.rb,Ruby写的),下载地址:http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.2.4-x64.exe
安装时勾选3个框,会把ruby加入环境变量。
(2)下载Ruby环境redis驱动,下载地址:https://rubygems.org/gems/redis/versions/3.2.2,右下角下载
(3)下载redis集群Ruby脚本,下载地址:https://raw.githubusercontent.com/MSOpenTech/redis/3.0/src/redis-trib.rb,另存为到redis安装目录去掉.txt改为.rb后缀
五、redis驱动安装和集群创建
(1)安装驱动:
gem install --local D:\Redis_dir\redis-trib.rb
(2)创建集群:
redis-trib.rb create --replicas 1 127.0.0.1:7000 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
(3)检查是否创建成功:
redis-trib.rb check 127.0.0.1:7000
(4)查看集群信息:
redis-cli.exe -c -p 7000
cluster info
参考博友:
实践出真知~