美文网首页
Redis-Sentinel集群的搭建

Redis-Sentinel集群的搭建

作者: 宁静的猫 | 来源:发表于2019-11-24 12:21 被阅读0次

1、配置文件

sentinel.conf:

port 26379
dir /data
logfile "sentinel.log"  //日志
sentinel monitor mymaster <master ip> <master port> 2 
sentinel down-after-milliseconds mymaster 30000
sentinel parallel-syncs mymaster 1
sentinel failover-timeout mymaster 180000
daemonize yes

2、搭建一主两从的Redis环境

执行命令:

docker run -d -p 6379:6379 -v /root/redis/r1/redis.conf:/etc/redis/redis.conf -v /root/redis/r1/data:/data:rw --name redis-6379 4760dc956b2d redis-server /etc/redis/redis.conf

docker run -d -p 6380:6380 -v /root/redis/r2/redis.conf:/etc/redis/redis.conf -v /root/redis/r2/data:/data:rw --name redis-6380 4760dc956b2d redis-server /etc/redis/redis.conf

docker run -d -p 6381:6381 -v /root/redis/r3/redis.conf:/etc/redis/redis.conf -v /root/redis/r3/data:/data:rw --name redis-6381 4760dc956b2d redis-server /etc/redis/redis.conf

3、搭建3个Redis-Sentinel集群

docker run -d -p 26379:26379 -v /root/redis/s1/sentinel.conf:/data/sentinel.conf --name sentinel-26379 4760dc956b2d
redis-sentinel sentinel.conf

docker run -d -p 26380:26380 -v /root/redis/s2/sentinel.conf:/data/sentinel.conf --name sentinel-26380 4760dc956b2d
redis-sentinel sentinel.conf

docker run -d -p 26381:26381 -v /root/redis/s3/sentinel.conf:/data/sentinel.conf --name sentinel-26381 4760dc956b2d
redis-sentinel sentinel.conf

相关文章

网友评论

      本文标题:Redis-Sentinel集群的搭建

      本文链接:https://www.haomeiwen.com/subject/bputwctx.html