标签:最大 查看 get pre timeout lov ast info mil
redis_sentinel 哨兵模式;
Redis 架构一般多是一主多从;
sentinel 三组进行相互监控;
wget http://download.redis.io/releases/redis-3.2.4.tar.gz tar -zxvf redis-3.2.4.tar.gz cd redis make && make install cp -rp redis/src/redis-trib.rb /usr/local/bin/ cp -rp redis/src/redis-sentinel /usr/local/bin/ mkdir -p redis/{redis_cluster,data,logs} yum -y install ruby ruby-devel rubygems rpm-build gem install redis
配置 Redis 的主从模式;
Redis - Port master - 6001 slave - 6002/6003 日志目录:logs/redis/{6001,6002,6003}/redis.log 数据目录:data/redis/{6001,6002,6003} 配置目录: master — redis.conf conf/6001/redis.conf slave — redis.conf conf/6002/redis.conf slave — redis.conf conf/6003/redis.conf Sentinel - port sentinel 26001 数据目录:data/tmp/26001/ 日志目录:logs/sentinel/{6001,6002,6003}/sentinel.log 配置目录:conf/26001/sentinel.conf
# cat sentinel.conf port 26001 dir "/vdb/redis/data/tmp/26001" sentinel monitor mymaster 127.0.0.1 6001 2 // 监控判定 master 失效;需要 2组 sentinel 同意; sentinel down-after-milliseconds mymaster 60000 // mymaster 设置未响应时间 SDOWN sentinel failover-timeout mymaster 180000 // failover切换时间 sentinel parallel-syncs mymaster 1 // 指定最大同时同步新maser配置的salve数量 sentinel auth-pass myMaster 1234 // 配置密码行 sentinel config-epoch mymaster 0 // 确认mymater SDOWN时长 sentinel leader-epoch mymaster 2 // 同时一时间最多2个slave可同时更新配置.
启动redis ;指定配置打印日志; [root@ redis]# cat start.sh src/redis-server conf/6001/redis.conf >> /opt/redis/logs/6001/redis.log & src/redis-server conf/6002/redis.conf >> /opt/redis/logs/6002/redis.log & src/redis-server conf/6003/redis.conf >> /opt/redis/logs/6003/redis.log & Sentinel 哨兵启动 [root@ redis]# cat sentinel-start.sh src/redis-sentinel sentinel/26001/sentinel.conf --sentinel &> /opt/redis/logs/26001/sentinel.log & 测试 src/redis-cli -h 127.0.0.1 -p 6001/6002/6003 > info 可以查看节点信息; // 尝试切断master 端口 ;会根据设置切换时间进行切换;
标签:最大 查看 get pre timeout lov ast info mil
原文地址:http://www.cnblogs.com/sharesdk/p/7867090.html