## experiment on a machine to allow, build Redis a master two from, create Sentinel mode monitoring ## entire script directly execute, confirm root permission to execute ## download directory mkdir / opt/softcd /opt/soft## download Software wget -o redis-2.8.22.tar.gz https:// codeload.github.com/antirez/redis/tar.gz/2.8.22## Decompression redistar -xf redis-2.8.22.tar.gzcd redis-2.8.22## Compiling and installing make prefix=/usr/local/redismake install prefix=/usr/local/redis## Create a basic directory here to do 1 master two from 6379 is the main, the other two are from Mkdir -p /usr/local/redis/etccd /usr/local/redis/etc/mkdir -p /usr/local/redis/etc/6379 ## ------ Start creating 6379 Main Library cd /usr/local/ redis/etc/6379## 6379 configuration file cat > redis.conf << eof## redis passwordrequirepass pass123## Master Password masterauth pass123## Background run daemonize yespidfile /usr/local/redis/etc/6379/redis.pid## Port Port 6379tcp-backlog 511timeout 0tcp-keepalive 0loglevel noticelogfile "/usr/local/redis/etc/6379/redis.log" databases 16save 900 1save 300 10save 60 10000stop-writes-on-bgsave-error yesrdbcompression Yesrdbchecksum yesdbfilename dump.rdbdir /usr/local/redis/etc/6379/cacheslave-serve-stale-data yes## read-only slave-read-only yesrepl-disable-tcp-nodelay noslave-priority 10## from library Open aofappendonly yesappendfilename "Appendonly.aof" Appendfsync everysecno-appendfsync-on-rewrite noauto-aof-rewrite-percentage 100auto-aof-rewrite-min-size 64mbaof-load-truncated Yeslua-time-limit 5000slowlog-log-slower-than 10000slowlog-max-len 128latency-monitor-threshold 0notify-keyspace-events "" hash-max-ziplist-entries 512hash-max-ziplist-value 64list-max-ziplist-entries 512list-max-ziplist-value 64set-max-intset-entries 512zset-max-ziplist-entries 128zset-max-ziplist-value 64hll-sparse-max-bytes 3000activerehashing yesclient-output-buffer-limit normal 0 0 0client-output-buffer-limit slave 256mb 64mb 60client-output-buffer-limit pubsub 32mb 8mb 60hz 10aof-rewrite-incremental-fsync yeseofcd /usr/local/ Redis/etc/6379## sentinel configuration file cat > sentinel.conf << eof# Sentinel Run Port port 26379# Monitor host Port transfer Request Sentinel if Sentinel two judgment fails monitor def_master 127.0.0.1 6379 2# Time-out 900 sec sentinel failover-timeout def_master 900000# master Password sentinel auth-pass def_master Cf03b7db40e654aeb3sentinel config-epoch def_master 0sentinel leader-epoch def_master 0EOFcd /usr/local/redis/etc## copy two copies from the Library by Port 6380 6381scp /usr/local/redis/etc/6379 /usr/local/redis/etc/6380cd / usr/local/redis/etc/6380sed -i "s#6379#6380#g" redis.confsed -i ' s#26379# 26380# ' sentinel.confecho ' slaveof 127.0.0.1 6379 ' >> Redis.confscp /usr/local/redis/etc/6379 /usr/local/redis/etc/6381cd /usr/local/redis/etc/6381sed -i "S#6379#6381#g" redis.confsed -i ' s#26379#26381# ' sentinel.confecho ' slaveof 127.0.0.1 6379 ' >> redis.conf### Here the basic environment is completed, now start the environment ### start master /usr/local/redis/bin/redis-server /usr/local/redis/etc/6379/redis.conf### start two from library /usr/local/redis/bin/redis-server /usr/local/redis/etc/6380/redis.conf /usr/local/redis/ bin/redis-server /usr/local/redis/etc/6381/redis.conf### Launch Sentinel /usr/local/redis/bin/redis-server /usr/local/ redis/etc/6379/sentinel.conf#### here to install the complete
This article is from the "Nano Dragon" blog, please be sure to keep this source http://arlen.blog.51cto.com/7175583/1696277
Redis Sentinel Cluster