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