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

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

相关推荐
-雷阵雨-16 分钟前
MySQL——数据库约束
数据库·mysql
大筒木老辈子17 分钟前
MySQL笔记---C/C++访问MySQL数据库
数据库·笔记·mysql
友友马21 分钟前
『 数据库 』MySQL复习(表的约束)
数据库·mysql
奥尔特星云大使38 分钟前
MySQL分布式架构:MyCat详解
数据库·分布式·mysql·mycat·高可用
SelectDB技术团队39 分钟前
Apache Doris 内部数据裁剪与过滤机制的实现原理 | Deep Dive
大数据·数据库·apache·数据库系统·数据裁剪
像风一样!1 小时前
学习MySQL数据库的高级特性(上)
数据库·mysql
夜泉_ly2 小时前
Redis -持久化
数据库·redis·缓存
Microsoft Word2 小时前
跨平台向量库:Linux & Windows 上一条龙部署 PostgreSQL 向量扩展
linux·windows·postgresql
用户31187945592182 小时前
redis-4.0.11-1.ky10.sw_64.rpm安装教程(申威麒麟V10 64位系统详细步骤)
redis
Wx-bishekaifayuan2 小时前
基于微信小程序的社区图书共享平台设计与实现 计算机毕业设计源码44991
javascript·vue.js·windows·mysql·pycharm·tomcat·php