1. 安裝Redis
10余年的玉州網(wǎng)站建設(shè)經(jīng)驗(yàn),針對(duì)設(shè)計(jì)、前端、開發(fā)、售后、文案、推廣等六對(duì)一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。成都全網(wǎng)營銷推廣的優(yōu)勢(shì)是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整玉州建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。創(chuàng)新互聯(lián)從事“玉州網(wǎng)站設(shè)計(jì)”,“玉州網(wǎng)站推廣”以來,每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。https://redis.io/download
將Redis安裝在D:\Program Files\Redis\
目錄下,然后將exe的可執(zhí)行文件copy到當(dāng)前的bin目錄,然后配置系統(tǒng)環(huán)境變量。
2. 安裝Ruby
http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.2.4-x64.exe
這里將Ruby安裝在C:\Ruby22-x64
目錄下。
3. 安裝Redis的Ruby庫
gem install redis
4. 配置Redis Node
copy6份Redis安裝目錄下的redis.windows-service.conf
文件依次重命名為redis7001.conf、redis7002.conf、redis7003.conf、redis8001.conf、redis8002.conf、redis8003.conf。并分別修改這6個(gè)配置文件。具體修改內(nèi)容如下:
redis7001.conf
port 7001 appendonly yes appendfilename "appendonly7001.aof" cluster-enabled yes cluster-config-file nodes-7001.conf cluster-node-timeout 15000 cluster-slave-validity-factor 10 cluster-migration-barrier 1 cluster-require-full-coverage yes
5. 編輯寫以下幾個(gè)簡單的腳步,以方便日常維護(hù)。
(1) 安裝redis服務(wù)腳本:
@echo off echo 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) 卸載redis服務(wù)腳本:
@echo off echo 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) 啟動(dòng)redis 服務(wù)腳本
@echo off echo 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 redis8003 echo start redis success @pause
(4) 停止redis服務(wù)腳本
@echo off echo 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 redis8003 echo stop redis success @pause
(5)瀏覽啟動(dòng)的端口
@echo off echo view redis startup ports netstat -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. 創(chuàng)建Redis Cluster
下載 https://raw.githubusercontent.com/MSOpenTech/redis/3.0/src/redis-trib.rb 腳本到Redis安裝目錄
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 cluster Connecting to node 127.0.0.1:7001: OK Connecting to node 127.0.0.1:7002: OK Connecting to node 127.0.0.1:7003: OK Connecting to node 127.0.0.1:8001: OK Connecting to node 127.0.0.1:8002: OK Connecting to node 127.0.0.1:8003: OK >>> Performing hash slots allocation on 6 nodes... Using 3 masters: 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 Adding replica 127.0.0.1:7001 to 127.0.0.1:8001 Adding replica 127.0.0.1:7002 to 127.0.0.1:8002 Adding replica 127.0.0.1:7003 to 127.0.0.1:8002 M: 49060b7f06bd3839895919a06ba43d0508b1149f 127.0.0.1:7001 slots:0-5460 (5461 slots) master M: 0bfbefc15a586f1a893ef150af43031a7ce04a9f 127.0.0.1:7002 slots:5461-10922 (5462 slots) master M: 5fb098d997e0f0b9e723b09400604344ec65179b 127.0.0.1:7003 slots:10923-16383 (5461 slots) master S: e2d74cfcccf88aef1dec16b1922ca2ad6dc16195 127.0.0.1:8001 replicates 49060b7f06bd3839895919a06ba43d0508b1149f S: bcbe8bf76a5b0d37768556ed752e30dcfea069f6 127.0.0.1:8002 replicates 0bfbefc15a586f1a893ef150af43031a7ce04a9f S: bbfc7026df6822bf3cfd8e4a3549b02ca57f7393 127.0.0.1:8003 replicates 5fb098d997e0f0b9e723b09400604344ec65179b Can 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 cluster Waiting 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) master M: 0bfbefc15a586f1a893ef150af43031a7ce04a9f 127.0.0.1:7002 slots:5461-10922 (5462 slots) master M: 5fb098d997e0f0b9e723b09400604344ec65179b 127.0.0.1:7003 slots:10923-16383 (5461 slots) master M: e2d74cfcccf88aef1dec16b1922ca2ad6dc16195 127.0.0.1:8001 slots: (0 slots) master replicates 49060b7f06bd3839895919a06ba43d0508b1149f M: bcbe8bf76a5b0d37768556ed752e30dcfea069f6 127.0.0.1:8002 slots: (0 slots) master replicates 0bfbefc15a586f1a893ef150af43031a7ce04a9f M: 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>
到此創(chuàng)建redis cluster 大功告成!
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。
分享標(biāo)題:windows上安裝配置redis群集-創(chuàng)新互聯(lián)
標(biāo)題鏈接:http://muchs.cn/article2/dsgeoc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站策劃、網(wǎng)站營銷、軟件開發(fā)、品牌網(wǎng)站建設(shè)、做網(wǎng)站、動(dòng)態(tài)網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容