redis哨兵模式配置方法

 

一台云主机:106.133.226.36

配置主机和端口:

106.133.226.36:6380

106.133.226.36:6381

106.133.226.36:6382

106.133.226.36:26380

106.133.226.36:26381

106.133.226.36:26382

 

新建文件 redis6380.conf

include /usr/local/software/redis-5.0.5/redis.conf
daemonize yes
port 6380
pidfile "/var/run/redis_6380.pid"
logfile "6380.log"
dbfilename "dump6380.rdb"
dir "/usr/local/software/redis-5.0.5/src"
appendonly yes
protected-mode no
requirepass "123456"
masterauth "123456"

新建文件 redis6381.conf

include /usr/local/software/redis-5.0.5/redis.conf
daemonize yes
port 6381
pidfile "/var/run/redis_6381.pid"
logfile "6381.log"
dbfilename "dump6381.rdb"
slaveof 106.133.226.36 6380
dir "/usr/local/software/redis-5.0.5/src"
appendonly yes
protected-mode no
requirepass "123456"
masterauth "123456"

新建文件 redis6382.conf

include /usr/local/software/redis-5.0.5/redis.conf
daemonize yes
port 6382
pidfile "/var/run/redis_6382.pid"
logfile "6382.log"
dbfilename "dump6382.rdb"
slaveof 106.133.226.36 6380
dir "/usr/local/software/redis-5.0.5/src"
appendonly yes
protected-mode no
requirepass "123456"
masterauth "123456"

 

配置哨兵模式的配置文件

新建文件 sentinel26380.conf

protected-mode no
daemonize yes
port 26380
dir "/tmp"
sentinel monitor mymaster 106.133.226.36 6380 2
sentinel auth-pass mymaster 123456

新建文件 sentinel26381.conf

protected-mode no
daemonize yes
port 26381
dir "/tmp"
sentinel monitor mymaster 106.133.226.36 6380 2
sentinel auth-pass mymaster 123456

新建文件 sentinel26382.conf

protected-mode no
daemonize yes
port 26382
dir "/tmp"
sentinel monitor mymaster 106.133.226.36 6380 2
sentinel auth-pass mymaster 123456

 

按顺序启动redis服务和redis哨兵模式:

进入redis安装目录,cd 到src目录

./redis-server /usr/local/software/redis-5.0.5/redis6380.conf

./redis-server /usr/local/software/redis-5.0.5/redis6381.conf

./redis-server /usr/local/software/redis-5.0.5/redis6382.conf

./redis-sentinel /usr/local/software/redis-5.0.5/sentinel26380.conf

./redis-sentinel /usr/local/software/redis-5.0.5/sentinel26381.conf

./redis-sentinel /usr/local/software/redis-5.0.5/sentinel26382.conf

 

已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 技术黑板 设计师:CSDN官方博客 返回首页