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

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

相关推荐
向風而行8 分钟前
MySQL详解
数据库·mysql
Curtain_Gin33 分钟前
windows nvim lazy
windows
belldeep1 小时前
本草纲目:如何应用 PostgreSQL 实现【中医药】主题数据库 ?
数据库·postgresql·本草纲目
Bert.Cai1 小时前
MySQL CURTIME()函数详解
数据库·mysql
Bert.Cai1 小时前
MySQL CURDATE()函数详解
数据库·mysql
NGSI vimp1 小时前
MySQL|MySQL 中 `DATE_FORMAT()` 函数的使用
数据库·mysql
HAWK eoni1 小时前
Mysql 驱动程序
数据库·mysql
二哈赛车手2 小时前
新人笔记---实现简易版的rag的bm25检索(利用ES),以及RAG上传时的ES与向量数据库双写
java·数据库·笔记·spring·elasticsearch·ai
sthnyph2 小时前
docker compose安装redis
redis·docker·容器
何中应2 小时前
CentOS 7安装、卸载MySQL数据库(二)
数据库·mysql·centos