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}

相关推荐
小小工匠11 小时前
Redis - 事务机制:能实现 ACID 属性吗
数据结构·redis·性能优化·并发·持久化
麦聪聊数据11 小时前
数据服务化时代:企业数据能力输出的核心路径
数据库
shushangyun_11 小时前
2026年快消品B2B系统推荐:支持终端门店订货、促销政策自动化的工具?
java·运维·网络·数据库·人工智能·spring·自动化
DARLING Zero two♡12 小时前
【MySQL数据库】数据类型与表约束
数据库·mysql
ofoxcoding12 小时前
在AI API聚合平台配置DeepSeek V3.2提示词缓存实战:快速接入与成本优化指南
人工智能·spring·缓存·ai
曹牧12 小时前
Oracle EXPLAIN PLAN
数据库·oracle
BD_Marathon12 小时前
SQL学习指南——视图
数据库·sql
活宝小娜13 小时前
mysql详细安装教程
数据库·mysql·adb
贤时间13 小时前
codex 助力oracle ebs 开发
数据库·oracle
秉承初心13 小时前
PostgreSQL 数据性能瓶颈突破实战
数据库·postgresql·oracle