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链接,如下:

相关推荐
simple_whu2 小时前
开启WSL的镜像网络模式
windows·wsl
曼岛_3 小时前
[Java实战]Spring Boot 整合 Redis(十八)
java·spring boot·redis
寻找沙漠的人5 小时前
Redis 缓存
数据库·redis·缓存
Clockwiseee5 小时前
SSTI记录
运维·服务器·redis·学习
modest —YBW6 小时前
Ollama+OpenWebUI+docker完整版部署,附带软件下载链接,配置+中文汉化+docker源,适合内网部署,可以局域网使用
人工智能·windows·docker·语言模型·llama
code在飞6 小时前
windows 部署 Kafka3.x KRaft 模式 不依赖 ZooKeeper
windows·分布式·zookeeper·kafka
RingWu6 小时前
微服务架构-限流、熔断:Alibaba Sentinel入门
微服务·架构·sentinel
belldeep6 小时前
WSL 安装 Debian 12 后,Linux 如何安装 redis ?
linux·redis·debian
LLLLLindream6 小时前
Redis——达人探店
数据库·redis·缓存
mikey棒棒棒6 小时前
lua脚本+Redission实现分布式锁
redis·分布式·lua·看门狗·redission