搭建redis哨兵模式

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

猜你喜欢

转载自www.cnblogs.com/jinggs/p/12579630.html