Redis哨兵模式搭建
搭建redis哨兵模式,一主两从三哨兵
1. 下载安装
#1 从官网下载redis安装包:此处是redis-5.0.7.tar.gz
#2 上传到目录 /utxt/soft
#3 解压
#4 cd /utxt/soft/redis-5.0.7
#5 编译源程序
1 make
2 cd src
3 make test
2. 修改配置文件
#1 复制配置文件redis.conf和sentinel.conf到 /uloc/redis_conf/6000
#2 修改34,35两个从服务器的配置文件redis.conf如下:
1 bind 192.168.150.34
2 port 6000
3 daemonize yes
4 pidfile /uloc/redis_conf/6000/redis34.pid
5 logfile "/uloc/redis_conf/6000/redis34.log"
6 dir /uloc/redis_conf/6000/
7 requirepass "czty_tqyb"
8 appendonly yes
9 appendfilename "appendonly.aof"
10 masterauth "czty_tqyb"
11 slave-read-only yes
12 slaveof 192.168.150.36 6002
#3 修改主服务器的配置文件redis.conf如下:
1 bind 192.168.150.36
2 port 6002
3 daemonize yes
4 pidfile /uloc/redis_conf/6002/redis36.pid
5 logfile "/uloc/redis_conf/6002/redis36.log"
6 dir /uloc/redis_conf/6002/
7 requirepass "czty_tqyb"
8 appendonly yes
9 appendfilename "appendonly.aof"
10 masterauth "czty_tqyb"
11 slave-read-only yes
#4 修改34,35,36配置文件sentinel_26000.conf和sentinel_26001.conf、sentinel_26002.conf
1 port 26002
2 daemonize yes
3 pidfile "/uloc/redis_conf/6002/redis-sentinel.pid"
4 logfile "/uloc/redis_conf/6002/redis-sentinel.log"
5 dir "/uloc/redis_conf/6002"
6 sentinel monitor master 192.168.150.36 6002 2
7 sentinel auth-pass master czty_tqyb
人生的路还很长,继续走吧