Windows 11 使用 Scoop 安装/管理 Redis 7(支持多版本切换)并用 NSSM 作为服务开机自启

本文目标:在 Windows 11 上用 Scoop 安装 Redis 7 ,实现类似 nvm 的多版本并存+一键切换 ,并用 NSSM 将 Redis7 注册为 Windows Service ,实现可控的开机自启(不再出现"黑盒自启")。


1. 安装 Scoop(未安装过才执行)

打开 PowerShell(建议 PowerShell 7 / 管理员或普通均可):

powershell 复制代码
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
iwr -useb https://get.scoop.sh | iex

2. 使用 Scoop 安装 Redis(默认版本)

powershell 复制代码
scoop install redis
redis-server --version

3. 多版本管理:查看/安装/切换(像 nvm 一样)

3.1 查看可用版本信息

powershell 复制代码
scoop info redis

3.2 安装指定版本(示例)

powershell 复制代码
scoop install redis@7.0.10

3.3 切换到指定版本

powershell 复制代码
scoop reset redis@7.0.10
redis-server --version

3.4 切回默认版本

powershell 复制代码
scoop reset redis

4. 最关键验证:确认当前运行的 redis-server 来自 Scoop

每次切版本后都建议验证一次:

powershell 复制代码
where redis-server
redis-server --version

确保 where redis-server 输出路径指向 Scoop 目录(通常类似:C:\Users\<你>\scoop\apps\redis\...)。


5. 将 Redis 7 注册为 Windows 服务并设置开机自启(可控、自解释)

5.1 安装 NSSM

powershell 复制代码
scoop install nssm

5.2 创建 Redis 服务(服务名:Redis7)

powershell 复制代码
$nssm = (Get-Command nssm).Source
$redis = (Get-Command redis-server).Source

& $nssm install Redis7 $redis
& $nssm set Redis7 Start SERVICE_AUTO_START
& $nssm start Redis7

5.3 查看服务状态

powershell 复制代码
Get-Service Redis7

5.4 卸载 Redis7 服务(干净移除)

powershell 复制代码
nssm stop Redis7
nssm remove Redis7 confirm

6. 排查"黑盒自启":用 Autoruns 定位 Redis 启动来源(可选)

如果你怀疑系统里还有其他 Redis 自启(任务计划/Run/服务/启动目录),可以打开 Autoruns:

  • Ctrl + F 搜索:redis

  • 复制命中的 Location / Image Path 进行判断(属于任务计划/Run/服务/启动目录等),必要时删除或禁用对应条目

    ::contentReference[oaicite:0]{index=0}

相关推荐
GottdesKrieges11 小时前
Redis哨兵模式新建用户和修改口令
数据库·redis
程序猿编码12 小时前
纯 C++ 手写 LLM 推理引擎:分页 KV 缓存、连续批、多卡张量并行全部内置
c++·深度学习·缓存·大模型推理·自动微分·模型推理
code2cat12 小时前
【随笔】RAG检索缓存:复用证据之前,先把权限和版本放进缓存键
java·人工智能·缓存·知识库·rag
二宝哥13 小时前
02.springboot项目对接国内模型实现对话聊天
数据库·人工智能·spring boot
秦时明月之君临天下13 小时前
MySQL purge 参数详解:innodb_purge_threads 与 innodb_purge_batch_size
数据库·mysql·1024程序员节
三垣网安13 小时前
某某大学心理健康教育平台弱口令及SQL注入漏洞
数据库·sql
打工仔折腾 AI13 小时前
AI Agent 工程化实战(二):5 分钟跑通 Deep Agent 并逐层拆解底层链路
java·数据库·人工智能·后端·python·langchain·ai agent 实战
Shaoshing13 小时前
MySQL视图
数据库
爱好曙光14 小时前
Redis Cluster 槽迁移:MOVED 重定向与拓扑刷新实战
redis·cluster·性能调优·moved·槽迁移
这个DBA有点耶14 小时前
测试全绿,上线三周数据没入账——那个95%的兼容度报告,漏掉的是边界
数据库·mysql·架构