redis的Sentinel模式(哨兵模式)的windows安装
来源:互联网 发布:网络数据抓包工具 编辑:程序博客网 时间:2024/06/06 00:10
一、下载windows版本的Redis
github下载地址:https://github.com/MSOpenTech/redis/tags
将压缩包解压,更名为Redis,放在D盘。
删除redis-server.pdb, redis-cli.pdb, redis-check-aof.pdb, redis-benchmark.pdb
删除Windows Service Documentation.docx, Redis on Windows.docx, Redis on Windows Release Notes.docx
删除redis.windows-service.conf
更名redis.windows.conf为redis.conf
创建sentinel.conf
二、修改配置文件
1、修改redis.conf
①、将bind 127.0.0.1改为# bind 127.0.0.1
②、将protected-mode yes改为protected-mode no
2、编辑sentinel.conf
# 当前Sentinel服务运行的端口
port 26379
# 保护模式 no
protected-mode no
# Sentinel去监视一个名为mymaster的主redis实例,
# 这个主实例的IP地址为本机地址127.0.0.1,端口号为6379,
# 而将这个主实例判断为失效至少需要2个Sentinel进程的同意,只要同意Sentinel的数量不达标,自动failover就不会执行
# 如果提供外网访问,实例的IP地址为服务器地址10.0.128.144。
sentinel monitor mymaster 10.0.128.144 6379 2
# down-after-milliseconds指定了Sentinel认为Redis实例已经失效所需的毫秒数。
# 当实例超过该时间没有返回PING,或者直接返回错误,那么Sentinel将这个实例标记为主观下线。
# 只有一个Sentinel进程将实例标记为主观下线并不一定会引起实例的自动故障迁移:只有在足够数量的Sentinel都将一个实例标记为主观下线之后,实例才会被标记为客观下线。
# 这时自动故障迁移才会执行
sentinel down-after-milliseconds mymaster 5000
# parallel-syncs指定了在执行故障转移时,最多可以有多少个从Redis实例在同步新的主实例,
# 在从Redis实例较多的情况下这个数字越小,同步的时间越长,完成故障转移所需的时间就越长
sentinel parallel-syncs mymaster 1
# 如果在failover-timeout该时间(ms)内未能完成failover操作,则认为该failover失败
sentinel failover-timeout mymaster 15000
三、把redis设置成windows服务
1、把redis服务宿主到windows服务
sc create Redis binpath= "\"D:\Redis\redis-server.exe\" --service-run redis.conf --loglevel verbose" start= auto
2、把sentinel组件(哨兵工具)宿主到windows服务
sc create RedisSentinel binpath= "\"D:\Redis\redis-server.exe\" --service-run sentinel.conf --sentinel --loglevel verbose" start= auto
3、启动这两个服务。
四、测试
①测试redis
1、保持运行的窗口,不要关闭。
2、在运行中输入cmd,然后把目录指向解压的Redis目录
3、启动Redis客户端程序
d:
cd Redis
redis-cli -h 10.0.128.144 -p 6379
set a "wahaha"
get a
②查看sentinel的状态
redis-cli -h 10.0.128.144 -p 26379
info sentinel
备注:
开启服务:sc start Redis
停止服务:sc stop Redis
卸载服务:sc delete Redis
停止服务:sc stop RedisSentinel
卸载服务:sc delete RedisSentinel
- redis的Sentinel模式(哨兵模式)的windows安装
- Redis的哨兵模式(Sentinel)
- Redis哨兵模式(Sentinel)
- redis sentinel(哨兵)模式
- Redis sentinel 哨兵模式
- Redis sentinel 哨兵模式
- redis的哨兵Sentinel
- redis的哨兵模式
- redis的哨兵模式
- Redis的哨兵模式
- Redis-sentinel哨兵模式集群方案配置
- Redis-sentinel哨兵模式集群方案配置
- Redis-sentinel哨兵模式集群方案配置
- redis主从切换---Sentinel(哨兵模式)
- Redis-sentinel哨兵模式集群方案配置
- redis的哨兵集群模式
- 基于哨兵【sentinel】模式的redis服务集群并与spring集成
- Laravel 5的redis哨兵(sentinel)支持
- Sikulix工具类
- TiledDynamicRESTLayer上获取属性信息
- [OS] Shell
- 【笔记】表插入排序
- 复选框回显
- redis的Sentinel模式(哨兵模式)的windows安装
- caffe学习系列:阅读solver和train_test的prototxt文件
- MySQL使用时的一些问题(持续更新)
- 设计模式学习三、迭代器模式
- 常用电子面单接口API及对接方式
- 浅谈Java中的hashcode方法
- C/C++头文件中<>与“”的区别详解
- 希尔排序
- Python Opencv3 定位蓝色图片