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

相关推荐
love530love1 天前
【保姆级教程】阿里 Wan2.1-T2V-14B 模型本地部署全流程:从环境配置到视频生成(附避坑指南)
人工智能·windows·python·开源·大模型·github·音视频
Chukai1231 天前
Windows 和 Linux 系统下修改防火墙机制开放端口
linux·运维·windows
酷ku的森1 天前
Redis中的hash数据类型
数据库·redis·哈希算法
Arva .1 天前
Redis
数据库·redis·缓存
博一波1 天前
Redis 集群:连锁银行的 “多网点智能协作系统”
数据库·redis·缓存
IT小农工1 天前
Windows 文件资源管理器无法预览文件内容word、ppt、excel、pdf
windows·word·powerpoint
要记得喝水1 天前
C#某公司面试题(含题目和解析)--1
开发语言·windows·面试·c#·.net
tuokuac1 天前
Redis 的相关文件作用
数据库·redis·缓存
lingggggaaaa1 天前
小迪安全v2023学习笔记(七十八讲)—— 数据库安全&Redis&CouchDB&H2database&未授权&CVE
redis·笔记·学习·算法·安全·网络安全·couchdb
得意霄尽欢1 天前
Redis之核心数据结构浅析
数据结构·redis