MASTER
yum install -y epel-releaseyum install -y redisvi /etc/redis.conf<code>bind 192.168.1.193protected-mode yesport 6379tcp-backlog 65535syslog-enabled yeslogfile /dev/nullmaxclients 51200timeout 0tcp-keepalive 300daemonize yessupervised nopidfile /var/run/redis_6379.pidloglevel noticedatabases 16always-show-logo yesstop-writes-on-bgsave-error yesrdbcompression yesrdbchecksum yesdbfilename dump.rdbdir /var/lib/redisreplica-serve-stale-data yesreplica-read-only yesrepl-diskless-sync norepl-diskless-sync-delay 5repl-disable-tcp-nodelay noreplica-priority 100lazyfree-lazy-eviction nolazyfree-lazy-expire nolazyfree-lazy-server-del noreplica-lazy-flush noappendonly noappendfilename "appendonly.aof"appendfsync everysecno-appendfsync-on-rewrite noauto-aof-rewrite-percentage 100auto-aof-rewrite-min-size 64mbaof-load-truncated yesaof-use-rdb-preamble 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-size -2list-compress-depth 0set-max-intset-entries 512zset-max-ziplist-entries 128zset-max-ziplist-value 64hll-sparse-max-bytes 3000stream-node-max-bytes 4096stream-node-max-entries 100activerehashing yesclient-output-buffer-limit normal 0 0 0client-output-buffer-limit replica 256mb 64mb 60client-output-buffer-limit pubsub 32mb 8mb 60hz 10dynamic-hz yesaof-rewrite-incremental-fsync yesrdb-save-incremental-fsync yes</code>redis-sentinelvi /etc/redis-sentinel.conf<code>port 26379bind LocalhostIPsyslog-enabled yesdir /tmp###监控mymaster主服务器,有2个sentinel主观认为master down,则批准master转移sentinel monitor mymaster MASTERIP 6379 2###在3000毫秒(3s)内无奈和master通信(ping或者info),则认为master downsentinel down-after-milliseconds mymaster 3000###这个配置项指定了在产生failover主备切换时最多能够有多少个slave同时对新的master进行同步,这个数字越小,实现failover所需的工夫就越长,然而如果这个数字越大###就意味着越多的slave因为replication而不可用。能够通过将这个值设为 1 来保障每次只有一个slave 处于不能解决命令申请的状态。sentinel parallel-syncs mymaster 1###同一个sentinel对同一个master两次failover之间的间隔时间###当一个slave从一个谬误的master那里同步数据开始计算工夫,直到slave被纠正为向正确的master那里同步数据时###当想要勾销一个正在进行的failover所须要的工夫。###当进行failover时,配置所有slaves指向新的master所需的最大工夫。不过,即便过了这个超时,slaves仍然会被正确配置为指向master,然而就不按parallel-syncs所配###置的规定来了。sentinel failover-timeout mymaster 180000</code>SLAVE装置redis,批改redis.conf配置文件,指向master进入集群执行slaveof 192.168.1.193 6379