標籤:linux redis 叢集
在此文章中,只介紹redis叢集的安裝步驟,若想知道詳細過程,請參閱以下幾篇文章:
Redis叢集_1.redis安裝
Redis叢集_2.redis主從配置
Redis叢集_3.redis 主從自動切換Sentinel
Redis叢集_4.redis 啟動指令碼
系統內容:CentOS 6.5 mini
軟體版本:redis-2.8.19
IP地址:
節點1:192.168.100.211
節點2:192.168.100.212
節點3:192.168.100.213
Redis安裝(三個節點)
1:安裝相關依賴包
# yum -y install gcc make
2:安裝redis(三個節點)
軟體上傳到/main目錄
# cd /main/
# tar zxvf redis-2.8.19.tar.gz
# mv redis-2.8.19/ redis/
# cd redis/
# make && make install
3:修改設定檔(三個節點)
# mkdir /main/redis/logs
# vi /main/redis/redis.conf
daemonize yes
logfile "/main/redis/logs/redis.log"
4:指定Slave(在Slave節點配置)
# vi /main/redis/redis.conf
slaveof 192.168.100.211 6379
5:啟動redis(三個節點)
# /main/redis/src/redis-server /main/redis/redis.conf
6:指定監聽Master(三個節點)
# vi /main/redis/sentinel.conf
port 26379
daemonize yes
sentinel monitor mymaster 192.168.100.211 6379 2
sentinel down-after-milliseconds mymaster 30000
sentinel parallel-syncs mymaster 1
sentinel failover-timeout mymaster 900000
logfile "/main/redis/logs/sentinel.log"
7:啟動sentinel(三個節點):
# /main/redis/src/redis-sentinel /main/redis/sentinel.conf
8:關閉防火牆(三個節點)
# service iptables stop
# chkconfig iptables off
9:設定開機啟動(三個節點)
# echo "/main/redis/src/redis-server /main/redis/redis.conf" >> /etc/rc.local
# echo "/main/redis/src/redis-sentinel /main/redis/sentinel.conf" >> /etc/rc.local
註:初次開機時,必須先啟動Master
到此redis安裝完畢
CentOS/Linux Redis叢集安裝