服務器一臺:
創新互聯公司成立于2013年,先為遼寧等服務建站,遼寧等地企業,進行企業商務咨詢服務。為遼寧企業網站制作PC+手機+微官網三網同步一站式服務解決您的所有建站問題。wget https://download.redis.io/releases/redis-6.2.7.tar.gz2、解壓redistar -zxvf redis-6.2.7.tar.gz
mv redis-6.2.7 /usr/local/redis3、編譯、安裝cd /usr/local/redis
make
make install PREFIX=/usr/local/redis配置主從、哨兵在目錄 /usr/loca/redis/conf 下創建以下文件
bind 0.0.0.0
port 6379
daemonize yes
protected-mode no
slave-read-only no
masterauth 1234
requirepass 1234redis2.confreplicaof 改為 redis1的ip和端口
bind 0.0.0.0
port 6380
daemonize yes
protected-mode no
slave-read-only no
masterauth 1234
requirepass 1234
replicaof 172.169.3.251 6379redis3.confreplicaof 改為 redis1的ip和端口
bind 0.0.0.0
port 6381
daemonize yes
protected-mode no
slave-read-only no
masterauth 1234
requirepass 1234
replicaof 172.169.3.251 6379sentinel1.confmyaster 后面 ip和端口 改為redis1的ip和端口
port 26379
dir /tmp
protected-mode no
daemonize yes
sentinel monitor mymaster 172.169.3.251 6379 2
sentinel auth-pass mymaster 1234
sentinel down-after-milliseconds mymaster 30000
sentinel parallel-syncs mymaster 1
sentinel failover-timeout mymaster 10000
sentinel deny-scripts-reconfig yessentinel2.confmyaster 后面 ip和端口 改為redis1的ip和端口
port 26380
dir /tmp
protected-mode no
daemonize yes
sentinel monitor mymaster 172.169.3.251 6379 2
sentinel auth-pass mymaster 1234
sentinel down-after-milliseconds mymaster 30000
sentinel parallel-syncs mymaster 1
sentinel failover-timeout mymaster 10000
sentinel deny-scripts-reconfig yessentinel3.confmyaster 后面 ip和端口 改為redis1的ip和端口
port 26381
dir /tmp
protected-mode no
daemonize yes
sentinel monitor mymaster 172.169.3.251 6379 2
sentinel auth-pass mymaster 1234
sentinel down-after-milliseconds mymaster 30000
sentinel parallel-syncs mymaster 1
sentinel failover-timeout mymaster 10000
sentinel deny-scripts-reconfig yes啟動服務start_all.sh
#bin/bash
REDIS_HOME=/usr/local/redis
CONFIG_HOME=/usr/loca/redis/conf
$REDIS_HOME/bin/redis-server $CONFIG_HOME/conf/redis1.conf &
sleep 1s
$REDIS_HOME/bin/redis-server $CONFIG_HOME/conf/redis2.conf &
sleep 1s
$REDIS_HOME/bin/redis-server $CONFIG_HOME/conf/redis3.conf &
sleep 1s
$REDIS_HOME/bin/redis-server $CONFIG_HOME/conf/sentinel1.conf --sentinel &
sleep 1s
$REDIS_HOME/bin/redis-server $CONFIG_HOME/conf/sentinel2.conf --sentinel &
sleep 1s
$REDIS_HOME/bin/redis-server $CONFIG_HOME/conf/sentinel3.conf --sentinel &chmod 777 start_all.sh
./start_all.sh查看服務ps -ef|grep redis
./redis-cli -p 6379 -a 1234
info replication
# 哨兵的IP和端口
spring.redis.sentinel.nodes=172.169.3.186:26379,172.169.3.186:26380,172.169.3.186:26381
# sentinel monitor mymaster 172.169.3.251 6379 2 與 這里的 mymaster 一致
spring.redis.sentinel.master=mymaster
# 哨兵是否需要密碼,如果未配置,則不需要
spring.redis.sentinel.password=
# redis主從的密碼,配置的為1234,故需要配置
spring.redis.password=1234
你是否還在尋找穩定的海外服務器提供商?創新互聯www.cdcxhl.cn海外機房具備T級流量清洗系統配攻擊溯源,準確流量調度確保服務器高可用性,企業級服務器適合批量采購,新人活動首月15元起,快前往官網查看詳情吧
分享題目:linux安裝redis哨兵-創新互聯
標題鏈接:http://www.yijiale78.com/article2/cdjhic.html
成都網站建設公司_創新互聯,為您提供品牌網站設計、品牌網站制作、外貿建站、網站維護、外貿網站建設、網站排名
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯