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中安装

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

相关推荐
篱笆院的狗1 小时前
MySQL 中 SQL 语句的详细执行过程
数据库·sql·mysql
Bytebase1 小时前
Bytebase 3.3.1 - DML一键回滚支持 Oracle
数据库·oracle
晴天qt011 小时前
[mysql]数据类型精讲
数据库·oracle
MaCa .BaKa2 小时前
35-疫苗预约管理系统(微服务)
spring boot·redis·微服务·云原生·架构·springcloud
拿破轮2 小时前
查询Hologres或postgresql中的数据
数据库·postgresql
声声codeGrandMaster4 小时前
django之账号管理功能
数据库·后端·python·django
互联网搬砖老肖4 小时前
运维打铁:Centos 7 安装 redis_exporter 1.3.5
运维·redis·centos
Elastic 中国社区官方博客4 小时前
使用 LangGraph 和 Elasticsearch 构建强大的 RAG 工作流
大数据·数据库·人工智能·elasticsearch·搜索引擎·ai·全文检索
AscendKing4 小时前
mongo客户端操作mongodb记录
数据库·mongodb
我的golang之路果然有问题4 小时前
案例速成GO+redis 个人笔记
经验分享·redis·笔记·后端·学习·golang·go