1. Installing Redis
Https://redis.io/download
Install Redis in the D:\Program Files\Redis\
directory, copy the EXE executable to the current bin directory, and then configure the system environment variables.
2. Install Ruby
Http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.2.4-x64.exe
This is where Ruby is installed in the C:\Ruby22-x64
directory.
3. Installing the Redis Ruby Library
Gem Install Redis
4. Configure Redis Node
Copy6 files under the Redis installation directory are renamed redis.windows-service.conf
to Redis7001.conf, redis7002.conf, redis7003.conf, redis8001.conf, redis8002.conf, Redis8003.conf. and modify these 6 configuration files separately. Details of the changes are as follows:
Redis7001.conf
Port 7001appendonly yesappendfilename "appendonly7001.aof" cluster-enabled yescluster-config-file Nodes-7001.confcluster-node-timeout 15000cluster-slave-validity-factor 10cluster-migration-barrier 1cluster-require-full-coverage Yes
5. The editor writes the following few simple steps to facilitate routine maintenance.
(1) Installing the Redis service script:
@echo offecho install redis services "D:\program files\redis\bin\redis-server.exe" --service-install f:\redis_cluster\7001\redis7001.conf --service-name redis7001 "D:\ Program files\redis\bin\redis-server.exe " --service-install f:\redis_cluster\7002\ redis7002.conf --service-name redis7002 "D:\program files\redis\bin\redis-server.exe" -- Service-install f:\redis_cluster\7003\redis7003.conf --service-name redis7003 "D:\Program Files\redis\bin\redis-server.exe " --service-install f:\redis_cluster\8001\redis8001.conf -- service-name redis8001 "D:\program files\redis\bin\redis-server.exe" --service-install F:\ redis_cluster\8002\redis8002.conf --service-name redis8002 "d:\program files\redis\bin\ Redis-server.exe " --service-install F:\Redis_cluster\8003\redis8003.conf --service-name Redis8003@pause
(2) uninstalling the Redis service script:
@echo offecho uninstall redis services "D:\ Program files\redis\bin\redis-server.exe " --service-uninstall --service-name redis7001" D:\ Program files\redis\bin\redis-server.exe " --service-uninstall --service-name redis7002" D:\ Program files\redis\bin\redis-server.exe " --service-uninstall --service-name redis7003" D:\ Program files\redis\bin\redis-server.exe " --service-uninstall --service-name redis8001" D:\ Program files\redis\bin\redis-server.exe " --service-uninstall --service-name redis8002" D:\ Program files\redis\bin\redis-server.exe " --service-uninstall --service-name Redis8003@pause
(3) Start Redis service script
@echo offecho start redis ... "d:\program files \redis\bin\redis-server.exe " --service-start --service-name redis7001" D:\Program Files\ Redis\bin\redis-server.exe " --service-start --service-name redis7002" D:\Program Files\ Redis\bin\redis-server.exe " --service-start --service-name redis7003" D:\Program Files\ Redis\bin\redis-server.exe " --service-start --service-name redis8001" D:\Program Files\ Redis\bin\redis-server.exe " --service-start --service-name redis8002" D:\Program Files\ Redis\bin\redis-server.exe " --service-start --service-name redis8003echo start redis success@pause
(4) Stop Redis service script
@echo offecho stop redis ... "d:\program files\ Redis\bin\redis-server.exe " --service-stop --service-name redis7001" D:\Program Files\Redis \bin\redis-server.exe " --service-stop --service-name redis7002" D:\Program Files\Redis\bin\ Redis-server.exe " --service-stop --service-name redis7003" d:\program files\redis\bin\ Redis-server.exe " --service-stop --service-name redis8001" d:\program files\redis\bin\ Redis-server.exe " --service-stop --service-name redis8002" d:\program files\redis\bin\ Redis-server.exe " --service-stop --service-name redis8003echo stop redis Success@pause
(5) Browse the ports that are started
@echo Offecho View Redis startup Portsnetstat-an |find "7001" Netstat-an |find "7002" Netstat-an |find "7003" Netstat-an |find "8001" Netstat-an |find "8002" Netstat-an |find "8003" @pause
6. create Redis Cluster
download https://raw.githubusercontent.com/msopentech/redis/3.0/src/redis-trib.rb script to Redis installation directory
d:\program files\redis\bin>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:8001 127.0.0.1:8002 127.0.0.1:8003>>> Creating clusterConnecting to node 127.0.0.1:7001: OKConnecting to Node 127.0.0.1:7002: okconnecting to node 127.0.0.1:7003: okconnecting to node 127.0.0.1:8001: okconnecting to node 127.0.0.1:8002: okconnecting to node 127.0.0.1:8003: OK>>> Performing hash slots Allocation on 6 nodes ... using 3 masters:127.0.0.1:7001127.0.0.1:7002127.0.0.1:7003adding replica 127.0.0.1:7001 to 127.0.0.1:8001Adding replica 127.0.0.1:7002 to 127.0.0.1:8002Adding replica 127.0.0.1:7003 to 127.0.0.1:8002m: 49060b7f06bd3839895919a06ba43d0508b1149f 127.0.0.1:7001 slots:0-5460 (5461 slots) masterM: 0bfbefc15a586f1a893ef150af43031a7ce04a9f 127.0.0.1:7002 slots:5461-10922 (5462 slots) masterM: 5fb098d997e0f0b9e723b09400604344ec65179b 127.0.0.1:7003 slots:10923-16383 (5461 slots) masterS: e2d74cfcccf88aef1dec16b1922ca2ad6dc16195 127.0.0.1:8001 replicates 49060b7f06bd3839895919a06ba43d0508b1149fs: bcbe8bf76a5b0d37768556ed752e30dcfea069f6 127.0.0.1:8002 replicates 0bfbefc15a586f1a893ef150af43031a7ce04a9fs: bbfc7026df6822bf3cfd8e4a3549b02ca57f7393 127.0.0.1:8003 replicates 5fb098d997e0f0b9e723b09400604344ec65179bCan I set the above configuration? (type ' yes ' to accept): yes>>> nodes configuration updated>>> assign a different Config epoch to each node>>> sending cluster meet messages to join the clusterWaiting for the cluster to join...>> > Performing Cluster Check (using node 127.0.0.1:7001) m: 49060b7f06bd3839895919a06ba43d0508b1149f 127.0.0.1:7001 slots:0-5460 (5461 Slots) masterm: 0bfbefc15a586f1a893ef150af43031a7ce04a9f 127.0.0.1:7002 slots :5461-10922 (5462 slots) masterM: 5fb098d997e0f0b9e723b09400604344ec65179b 127.0.0.1:7003 slots:10923-16383 (5461 slots) masterM: e2d74cfcccf88aef1dec16b1922ca2ad6dc16195 127.0.0.1:8001 slots: (0 slots) master replicates 49060b7f06bd3839895919a06ba43d0508b1149fM: Bcbe8bf76a5b0d37768556ed752e30dcfea069f6 127.0.0.1:8002 slots: (0 slots) master replicates 0bfbefc15a586f1a893ef150af43031a7ce04a9fm: bbfc7026df6822bf3cfd8e4a3549b02ca57f7393 127.0.0.1:8003 slots: (0 slots) master replicates 5fb098d997e0f0b9e723b09400604344ec65179b[ok] all nodes agree about slots configuration.>>> check for open slots...>>> check slots Coverage ... [Ok] all 16384 slots covered. D:\program files\redis\bin>
To create Redis cluster!
This article is from the "-= lake-side Bamboo =-" blog, please be sure to keep this source http://bronte.blog.51cto.com/2418552/1900698
Configuring Redis clusters on Windows installation