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

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

相关推荐
RestCloud10 小时前
SQL Server到Hive:批处理ETL性能提升30%的实战经验
数据库·api
RestCloud10 小时前
为什么说零代码 ETL 是未来趋势?
数据库·api
ClouGence12 小时前
CloudCanal + Paimon + SelectDB 从 0 到 1 构建实时湖仓
数据库
DemonAvenger19 小时前
NoSQL与MySQL混合架构设计:从入门到实战的最佳实践
数据库·mysql·性能优化
AAA修煤气灶刘哥1 天前
别让Redis「歪脖子」!一次搞定数据倾斜与请求倾斜的捉妖记
redis·分布式·后端
AAA修煤气灶刘哥1 天前
后端人速藏!数据库PD建模避坑指南
数据库·后端·mysql
RestCloud1 天前
揭秘 CDC 技术:让数据库同步快人一步
数据库·api
得物技术2 天前
MySQL单表为何别超2000万行?揭秘B+树与16KB页的生死博弈|得物技术
数据库·后端·mysql
christine-rr2 天前
linux常用命令(4)——压缩命令
linux·服务器·redis
可涵不会debug2 天前
【IoTDB】时序数据库选型指南:工业大数据场景下的技术突围
数据库·时序数据库