標籤:style http ar io color sp strong on 檔案
這裡只是總結一下安裝步驟如果要瞭解redis叢集高可用的原理,推薦仔細看一遍設定檔樣本http://download.redis.io/redis-stable/redis.conf,源碼包裡也有,裡面的注釋都是乾貨,看完會非常有協助。
1、安裝wget http://download.redis.io/releases/redis-2.8.18.tar.gztar xf redis-2.8.18.tar.gzcd redis-2.8.18.tar.gzmake mkdir /usr/local/redis-bin #建立redis安裝目錄#複製編譯出來的bin檔案到安裝目錄cp src/redis-* /usr/local/redis-bin#複製預設設定檔到安裝目錄cp redis.conf /usr/local/redis-bincp sentinel.conf /usr/local/redis-bin
2、配置(redis服務一主一從,故障選舉服務三台)vi redis.conf #配置redis,兩台daemonize yes #redis在後台執行logfile "/usr/local/redis-bin/redis.log" #redis日誌輸出slaveof 192.168.166.131 6379 #slave節點需要配置主master節點的資訊 #redis要求的,kernel參數修改,重啟生效vim /etc/sysctl.confvm.overcommit_memory = 1net.core.somaxconn = 511 vi sentinel.conf #配置故障選舉服務,三台添加:daemonize yeslogfile "/usr/local/redis-bin/sentinel.log"修改sentinel monitor mymaster 192.168.166.131 6379 2
3、起動關閉redis起動:/usr/local/redis-bin/redis-server /usr/local/redis-bin/redis.conf關閉:/usr/local/redis-bin/redis-cli shutdownsentinel起動:/usr/local/redis-bin/redis-sentinel /usr/local/redis-bin/sentinel.conf關閉:/usr/local/redis-bin/redis-cli -p 26379 shutdown
生產環境的redis高可用叢集搭建