Windows版本的Redis即可直接从GitHub上下载,也可通过Scoop下载。
但建议用scoop下载,因为Scoop可以实现在Windows上下载很多只能在Linux上使用的软件。
powershell
# 一、安装NSSM托管(适合各种程序)。
scoop install nssm
# 二、注册Redis服务(管理员PowerShell)。
$nssm=(Get-Command nssm).Source
$redis=(Get-Command redis-server).Source
# 2.1 安装服务,名字叫 Redis
& $nssm install Redis $redis
# 2.2 指定配置文件参数。
# 注意:scoop下载redis没有"redis.windows.conf"文件,但有"redis.conf"文件,二者功能一致。
& $nssm set Redis AppParameters "redis.windows.conf"
# 2.3 开机自启
& $nssm set Redis Start SERVICE_AUTO_START
# 2.4 启动服务
& $nssm start Redis
# 三、查看服务状态。
Get-Service Redis
# 四、卸载服务。
nssm stop Redis
nssm remove Redis confirm