Windows下搭建Redis Sentinel

下载安装程序

下载Redis关于Windows安装程序,下载地址

下载成功后进行解压,解压如下:

配置redis和sentinel

首先复制三份redis.windows.conf,分别命名为:redis.6379.conf、redis.6380.conf、redis.6381.conf,然后分别修改redis.6380.conf、redis.6381.conf对应文件中的port为6380和6381,redis.6379.conf不用修改默认使用6379。

再创建文件,命名为sentinel.26379.conf 然后编辑如下:

bat 复制代码
port 26379
protected-mode no
bind 127.0.0.1
sentinel monitor mymaster 127.0.0.1 6379 2
sentinel down-after-milliseconds mymaster 5000
sentinel failover-timeout mymaster 15000
sentinel config-epoch mymaster 2
sentinel leader-epoch mymaster 2

接着复制两份sentinel.26379.conf 分别名称为sentinel.26380.conf 和sentinel.26381.conf,唯一修改的是port,sentinel.26380.conf修改为26380,sentinel.26381.conf修改为26381.

配置启动脚本

创建文件redis-6379.bat、redis-6380.bat和redis-6381.bat配置如下:

bat 复制代码
title "6379"
D:\soft-exe\Redis-x64-5.0.14.1\redis-server.exe "D:\soft-exe\Redis-x64-5.0.14.1\conf\redis.6379.conf"
bat 复制代码
title "6380"
D:\soft-exe\Redis-x64-5.0.14.1\redis-server.exe "D:\soft-exe\Redis-x64-5.0.14.1\conf\redis.6380.conf"
bat 复制代码
title "6381"
D:\soft-exe\Redis-x64-5.0.14.1\redis-server.exe "D:\soft-exe\Redis-x64-5.0.14.1\conf\redis.6381.conf"

上面的路径根据你实际的解压路径来。

创建文件sentinel-26379.bat、sentinel-26380.bat和sentinel-26381.bat配置如下:

bat 复制代码
title "26379"
D:\soft-exe\Redis-x64-5.0.14.1\redis-server.exe "D:\soft-exe\Redis-x64-5.0.14.1\conf\sentinel.26379.conf" --sentinel
bat 复制代码
title "26380"
D:\soft-exe\Redis-x64-5.0.14.1\redis-server.exe "D:\soft-exe\Redis-x64-5.0.14.1\conf\sentinel.26380.conf" --sentinel
bat 复制代码
title "26381"
D:\soft-exe\Redis-x64-5.0.14.1\redis-server.exe "D:\soft-exe\Redis-x64-5.0.14.1\conf\sentinel.26381.conf" --sentinel

配置一键启动脚本

创建start.bat,编辑如下:

bat 复制代码
@echo off 
start /D "D:\soft-exe\Redis-x64-5.0.14.1\conf" redis-6379.bat
start /D "D:\soft-exe\Redis-x64-5.0.14.1\conf" redis-6380.bat
start /D "D:\soft-exe\Redis-x64-5.0.14.1\conf" redis-6381.bat
start /D "D:\soft-exe\Redis-x64-5.0.14.1\conf" sentinel-26379.bat
start /D "D:\soft-exe\Redis-x64-5.0.14.1\conf" sentinel-26380.bat
start /D "D:\soft-exe\Redis-x64-5.0.14.1\conf" sentinel-26381.bat

启动效果如下:

安装redis管理工具

我用的redis官方提供的:RedisInsight,下载前你需要先登录。

下载和安装

下载地址

下载成功后进行安装,安装成功后启动程序后,你可以通过ADD REDIS DATABASE添加redis链接,如下:

相关推荐
半新半旧1 小时前
python 整合使用 Redis
redis·python·bootstrap
daixin88483 小时前
什么是缓存雪崩?缓存击穿?缓存穿透?分别如何解决?什么是缓存预热?
java·开发语言·redis·缓存
吳所畏惧4 小时前
NVM踩坑实录:配置了npm的阿里云cdn之后,下载nodejs老版本(如:12.18.4)时,报404异常,下载失败的问题解决
前端·windows·阿里云·npm·node.js·batch命令
leese2334 小时前
FreeMarker模板引擎
windows
daixin88485 小时前
Redis过期数据的删除策略是什么?有哪些?
数据库·redis·缓存
love530love5 小时前
命令行创建 UV 环境及本地化实战演示—— 基于《Python 多版本与开发环境治理架构设计》的最佳实践
开发语言·人工智能·windows·python·conda·uv
呉師傅5 小时前
佳能iR-ADV C5560复印机如何扫描文件到电脑
运维·网络·windows·计算机外设·电脑
程序视点5 小时前
【最新专业评测】PDF Reducer专业版:85%超高压缩率的PDF压缩神器|Windows最佳PDF压缩工具推荐
windows
幻灭行度8 小时前
通过redis_exporter监控redis cluster
数据库·redis·缓存
qyhua9 小时前
Windows 平台源码部署 Dify教程(不依赖 Docker)
人工智能·windows·python