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

相关推荐
Abigail_chow1 小时前
EXCEL如何快速批量给两字姓名中间加空格
windows·microsoft·excel·学习方法·政务
潘yi.2 小时前
NoSQL之Redis配置与优化
数据库·redis·nosql
伤不起bb2 小时前
NoSQL 之 Redis 配置与优化
linux·运维·数据库·redis·nosql
love530love3 小时前
【笔记】在 MSYS2(MINGW64)中正确安装 Rust
运维·开发语言·人工智能·windows·笔记·python·rust
14L4 小时前
互联网大厂Java面试:从Spring Cloud到Kafka的技术考察
spring boot·redis·spring cloud·kafka·jwt·oauth2·java面试
小马爱记录4 小时前
sentinel规则持久化
java·spring cloud·sentinel
一个有女朋友的程序员4 小时前
Spring Boot 缓存注解详解:@Cacheable、@CachePut、@CacheEvict(超详细实战版)
spring boot·redis·缓存
代码搬运媛4 小时前
“packageManager“: “[email protected]“ 配置如何正确启动项目?
windows·webpack
小道士写程序5 小时前
Qt 5.12 上读取 .xlsx 文件(Windows 平台)
开发语言·windows·qt
yuren_xia5 小时前
在Spring Boot中集成Redis进行缓存
spring boot·redis·缓存