1.环境准备
- master节点1个
- slave节点2个
- sentinel【哨兵】节点3个
- redis版本5.0.3
- 操作系统:Centos7
2.主从节点配置
创建redis-conf目录,此目录用于存放主从节点的配置文件
复制redis.conf,然后创建三个配置文件:redis-6379.conf,redis-6380.conf,redis-6381.conf
编辑主节点的配置文件,redis-6379.conf,增加一个密码
daemonize yes requirepass 123456
编辑从节点的配置文件,redis-6380.conf
port 6380 daemonize yes pidfile "/var/run/redis_6380.pid" logfile "6380.log" dir "/var/tmp/redis-5.0.3/data/6380" replicaof 127.0.0.1 6379 masterauth 123456 appendonly yes appendfilename "appendonly.aof" requirepass 123456
编辑从节点的配置文件,redis-6381.conf
port 6381 daemonize yes pidfile "/var/run/redis_6381.pid" logfile "6381.log" dir "/var/tmp/redis-5.0.3/data/6381" replicaof 127.0.0.1 6379 masterauth 123456 appendonly yes appendfilename "appendonly.aof" requirepass 123456
标签:配置文件,Redis,redis,模式,哨兵,6381,6380,conf,节点 From: https://www.cnblogs.com/liuyangjava/p/17485115.html