Redis Sentinel——安装部署

1、部署结构图

1.1、redis sentinel实例拓扑图

Redis Sentinel——安装部署_第1张图片

1.2、物理结构表

Redis Sentinel——安装部署_第2张图片

2、redis的安装

2.1、配置修改redis.conf文件名称为redis-6379.conf

	port		6379
	daemonize 	yes
	logfile 	"6379.log"
	dbfilename 	"dump-6379.rdb"
	dir 		"/opt/soft/redis/data/"

3、配置从节点redis-6380.conf 与 redis-6381.conf

	port		6380
	daemonize 	yes
	logfile 	"6380.log"
	dbfilename 	"dump-6380.rdb"
	dir 		"/opt/soft/redis/data/"
        slaveof 127.0.0.1 6379

 

	port		6381
	daemonize 	yes
	logfile 	"6381.log"
	dbfilename 	"dump-6381.rdb"
	dir 		"/opt/soft/redis/data/"
        slaveof 127.0.0.1 6379

 

3.1、启动端口6379、6380、6381节点

3.2、确认主从关系: info replication

 

Redis Sentinel——安装部署_第3张图片

 

Redis Sentinel——安装部署_第4张图片

 

Redis Sentinel——安装部署_第5张图片

 

4、配置Sentinel节点

4.1、备份sentinel.conf文件,然后复制该文件并命名为redis-sentinel-26379.conf、redis-sentinel-26380.conf、redis-sentinel-26381.conf

4.2、修改sentinel节点配置文件

port   26379 
daemonize 	yes
logfile 	"26379.log"
dir /opt/soft/redis/data

sentinel monitor mymaster 127.0.0.1 6379 2

sentinel down-after-milliseconds mymaster 30000

sentinel parallel-syncs mymaster 1

sentinel failover-timeout mymaster 180000

 

	port   26380	daemonize 	yes
	logfile 	"26380.log"
dir /opt/soft/redis/data

sentinel monitor mymaster 127.0.0.1 6379 2

sentinel down-after-milliseconds mymaster 30000

sentinel parallel-syncs mymaster 1

sentinel failover-timeout mymaster 180000

 

	port   26381	daemonize 	yes
	logfile 	"26381.log"
dir /opt/soft/redis/data

sentinel monitor mymaster 127.0.0.1 6379 2

sentinel down-after-milliseconds mymaster 30000

sentinel parallel-syncs mymaster 1 

sentinel failover-timeout mymaster 180000

 

4.3、启动sentinel节点

4.3.1、方法一:使用redis-sentinel命令

redis-sentinel  redis-sentinel-6379.conf

4.3.2、方法二:使用redis-server命令加 --sentinel参数

redis-server  redis-sentinel-6379.conf  --sentinel

 

4.4、确认  redis-cli -h 127.0.0.1 -p 26379 / info Sentinel


Redis Sentinel——安装部署_第6张图片

 

 

 

 

 

 

 

 

 

 

你可能感兴趣的:(redis)