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

相关推荐
2501_9032386523 分钟前
Git Bash:Windows下的强大命令行工具
windows·git·bash·个人开发
甜可儿25 分钟前
redis序列化设置
数据库·redis
吃汤圆的抹香鲸1 小时前
GoLand 安装包 绿色版 Win,Mac,Linux 包含IntelliJ全家桶 专为Go语言设计的集成开发环境(IDE)
linux·windows·macos·go·intellij-idea·go1.19
千层冷面2 小时前
Redis除了做缓存还能做什么?
数据库·redis·缓存
吃汤圆的抹香鲸2 小时前
Rider 安装包 绿色版 Win/Mac/Linux 适合.NET和游戏开发者使用 2025全栈开发终极指南:从零配置到企业级实战
linux·运维·windows·sql·游戏·macos·.net
码有余悸3 小时前
Redis:高性能的键值存储系统
数据库·redis·缓存
老朋友此林10 小时前
浅析 Redis 分片集群 Cluster 原理、手动搭建、动态伸缩集群、故障转移
java·数据库·redis
学海无涯,行者无疆11 小时前
使用Jenkins实现Windows服务器下C#应用程序发布
windows·c#·jenkins·.net·cicd·自动发布·一键发布
因兹菜12 小时前
[LeetCode]day29 232.用栈实现队列
redis·算法·leetcode
做咩啊~12 小时前
windows设置暂停更新时长
windows