Redis Sentinel(主从切换配置)--windows

E:\ronggang\redis\redis-master

1主2从3 sentinel 架构

参考博客
1. 下载redis Redis-x64-3.0.504
2. 解压
3. 拷贝6份
4. 修改配置文件
- redis.conf

port 6379
bind 127.0.0.1
  • redis6380.conf
port 6380
bind 127.0.0.1
slaveof 127.0.0.1 6379
  • redis6381.conf
port 6381
bind 127.0.0.1
slaveof 127.0.0.1 6379
  • sentinel.conf
port 26379
sentinel monitor mymaster 127.0.0.1 6379 2
sentinel down-after-milliseconds mymaster 5000
sentinel failover-timeout mymaster 15000
sentinel config-epoch mymaster 1
  • sentinel26479.conf
port 26479
sentinel monitor mymaster 127.0.0.1 6379 2
sentinel down-after-milliseconds mymaster 5000
sentinel failover-timeout mymaster 15000
sentinel config-epoch mymaster 1
  • sentinel26579.conf
port 26579
sentinel monitor mymaster 127.0.0.1 6379 2
sentinel down-after-milliseconds mymaster 5000
sentinel failover-timeout mymaster 15000
sentinel config-epoch mymaster 1
启动Redis集群
切换到各自redis安装目录下
redis-server.exe redis.conf  
redis-server.exe redis6380.conf  
redis-server.exe redis6381.conf 
redis-server.exe sentinel.conf --sentinel  
redis-server.exe sentinel26479.conf --sentinel  
redis-server.exe sentinel26579.conf --sentinel
window 批处理启动脚本

start.bat

start redis-master\startmaster.bat
ping -n 3 127.0.0.1>null
start redis-slave\startslave.bat
ping -n 2 127.0.0.1>null
start redis-slave1\startslave1.bat

start redis-sentinel1\startsentinel.bat
ping -n 2 127.0.0.1>null
start redis-sentinel2\startsentinel26479.bat
ping -n 2 127.0.0.1>null
start redis-sentinel3\startsentinel26579.bat
pause

startmaster.bat

cd E:\ronggang\redis\redis-master
redis-server.exe redis.conf

startslave.bat
cd E:\ronggang\redis\redis-slave
redis-server.exe redis6380.conf

startslave1.bat
cd E:\ronggang\redis\redis-slave1
redis-server.exe redis6381.conf

startsentinel.bat

cd E:\ronggang\redis\redis-sentinel1
redis-server.exe sentinel.conf --sentinel

startsentinel26479.bat
cd E:\ronggang\redis\redis-sentinel2
redis-server.exe sentinel26479.conf --sentinel

startsentinel26579.bat
cd E:\ronggang\redis\redis-sentinel3
redis-server.exe sentinel26579.conf --sentinel
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值