redis3.0 叢集在windows上的配置

來源:互聯網
上載者:User

標籤:barrier   server   lease   releases   127.0.0.1   conf   copy   config   檔案   

1. 安裝Redis
版本:win-3.0.501
https://github.com/MSOpenTech/redis/releases頁面有,我下載的是zip版本的:Redis-x64-3.0.501.zip;最好也下載原始碼的zip包。


將redis解壓,如解壓到d:\rediscluster\redis(壓縮包內無檔案夾)


2. 安裝Ruby


http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.2.4-x64.exe


這裡將Ruby安裝在C:\Ruby22-x64目錄下。


3. 安裝Redis的Ruby庫
執行命令:

[html] view plain copy 
  1. gem install redis  



這裡我們中國的使用者可能會被牆掉,無法串連伺服器,從其他人的文章中發現了一個可用的source,修改source的步驟如下:
1.刪除原有source
  使用gem sources命令,查看已有的源,然後用:gem source -r http://rubygems.org/ 命令刪掉原來所有的源,http://rubygems.org/就是gem sources命令列出的源的地址,確保源全刪掉
2.加入新的源:
  

[html] view plain copy 
  1. gem source -a http://production.s3.rubygems.org.s3.amazonaws.com/  

 

還有個辦法,就是本地安裝,我去 https://rubygems.org/gems/Redis/versions/3.3.0下載了gem檔案,然後執行命令:

 

[html] view plain copy 
  1. gem install --local path_to_gem/filename.gem  

,網站可以訪問,但下載不行,我使用goagent才下載下來的。

 

  http://production.s3.rubygems.org.s3.amazonaws.com/ 這個源還好,能用哈哈
3.再次執行:gem install redis 這樣就沒問題了。


4. 配置Redis Node
建立第一個redis.7000.conf檔案(服務連接埠7000),配置如下:


redis.7000.conf

[html] view plain copy 
  1. port 7000  
  2. appendonly yes  
  3. appendfilename "appendonly.7000.aof"  
  4. cluster-enabled yes  
  5. cluster-config-file nodes-7000.conf  
  6. cluster-node-timeout 15000  
  7. cluster-slave-validity-factor 10  
  8. cluster-migration-barrier 1  
  9. cluster-require-full-coverage yes  



拷貝5份d:\rediscluster\redis目錄下的redis.7000.conf檔案,依次命名為redis.7001.conf至redis.7005.conf,形成6個設定檔。即準備配置6個redis節點,每個節點的設定檔使用redis.連接埠.conf命名。
在設定檔內部修改參數,注意,這6個檔案中的port,appendfilename,cluster-config-file不要重名。
5.啟動redis服務
  用命令視窗,在d:\rediscluster\redis目錄中,執行命令:redis-server.exe redis.連接埠.conf啟動redis執行個體,將6個連接埠的配置都執行一下,共6個視窗。沒錯誤就OK了,有問題也就是連接埠衝突了。
  如果不想用命令視窗形式啟動,可以安裝redis為windows服務,命令視窗切換到在d:\rediscluster\redis目錄下,安裝服務命令為:

[html] view plain copy 
  1. redis-server.exe --service-install redis.7000.conf --service-name redis7000  

  將此命令修改後(設定檔名和服務名),執行6次,依次把6個設定檔都安裝為服務,然後啟動服務就可以了。


6.建立叢集
  下載ruby檔案:https://raw.githubusercontent.com/MSOpenTech/redis/3.0/src/redis-trib.rb,如果在第一步時頁面下載了redis原始碼,那麼它的src下也有這個檔案。
  將redis-trib.rb放到某檔案夾下,在命令視窗中用執行命令:
  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

 

 


  會提示是否確定,輸入yes後,就ok了

 

 

http://blog.csdn.net/yys79/article/details/51566417

 

redis3.0 叢集在windows上的配置(轉)

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.