Redis之在Windows安装及高版本编译安装方法

Redis之在Windows安装及高版本编译安装方法

文章目录

  1. Redis官方并未提供Windows版本的Redis数据库,2016年微软提供Windows版本,但最高稳定版本为 3.0.504,最新版本为3.2.100;
  2. Github下载地址:https://github.com/MicrosoftArchive/redis/releases

1. Redis-x64-3.2.100.zip版本安装

1. 下载与安装

GitHub上提供了Redis-x64-3.2.100.msi包与Redis-x64-3.2.100.zip包。本文下载的是Redis-x64-3.2.100.zip

  1. 将下载的Redis安装包解压到指定目录,这里解压到"D:\Redis-x64-3.2.100"目录下
  2. 配置环境变量

将"D:\Redis-x64-3.2.100"目录添加到环境变量的的path变量后面

2. 将Redis注册为Windows的服务运行

  1. 在"D:\Redis-x64-3.2.100"目录下打开命令行窗口,并行下面代码
shell 复制代码
# 注册服务
redis-server --service-install redis.windows-service.conf --loglevel verbose

# 卸载服务
redis-server --service-uninstall

执行完上面代码后,会在Windows服务中注册一个名称为Redis的服务。

  1. 启动与停止服务
shell 复制代码
# 启动Redis服务
redis-server --service-start
# 或 net start Redis
# 停止Redis服务
redis-server --service-stop
# 或  net stop Redis
  1. --service-name name 选项使用

此可选参数可与前面的任何命令一起使用,以设置已安装服务的名称。此参数应遵循service install、service start、service stop或service uninstall命令,并在通过service install命令传递给redis的任何参数之前。

下面将安装并启动三个单独的redis实例作为服务:

shell 复制代码
# 注册一个服务名为"redisService1"的Redis服务器,且指定端口为10001
redis-server --service-install --service-name redisService1 --port 10001
# 启动名称为"redisService1"的Redis服务器
redis-server --service-start --service-name redisService1
# 以下redisService2,redisService3与redisService1注册方式相同
redis-server --service-install --service-name redisService2 --port 10002
redis-server --service-start --service-name redisService2
redis-server --service-install --service-name redisService3 --port 10003
redis-server --service-start --service-name redisService3

3.远程连接设置

  1. 注释仅限本地访问绑定
shell 复制代码
# 在redis.windows-service.conf文件中找到 bind 127.0.0.1 并注释,如下
# bind 127.0.0.1 
  1. 将保护模式设置为no
shell 复制代码
# 默认为 protected-mode yes
# 将yes 该为no
protected-mode no

2. Windows中高版本编译安装

如果想要在Windows使用高版本的Redis,需要自行编译,可参考本人B站的编译视频 20220910最新版Redis7源码编译及windows中安装

如果觉得还可以请给个一键三连

相关推荐
sysin.org10 分钟前
VMware ESXi 7.0U3q macOS Unlocker 集成驱动版更新 OEM BIOS 2.7 支持 Windows Server 2025
windows·macos·esxi·bios·oem·网卡驱动·nvme驱动
shuxianshrng22 分钟前
大气网格化精细化监管监测系统
大数据·服务器·windows·经验分享
2401_8470565527 分钟前
Altium Designer脚本工具定制
网络·数据库
神仙别闹37 分钟前
基于Python+SQLite的课程管理系统
数据库·sqlite
掐指一算乀缺钱40 分钟前
SpringBoot 数据库表结构文档生成
java·数据库·spring boot·后端·spring
晚睡早起₍˄·͈༝·͈˄*₎◞ ̑̑1 小时前
苍穹外卖学习笔记(七)
java·windows·笔记·学习·mybatis
少年负剑去1 小时前
django分发路由
数据库·django·sqlite
飞翔的佩奇1 小时前
xxl-job适配sqlite本地数据库及mysql数据库。可根据配置指定使用哪种数据库。
数据库·spring boot·mysql·sqlite·xxl-job·任务调度
芊言芊语1 小时前
分布式缓存服务Redis版解析与配置方式
redis·分布式·缓存
吱吱鼠叔2 小时前
MATLAB数据文件读写:1.格式化读写文件
前端·数据库·matlab