如何在Windows上运行Redis ?Redis下载页面似乎提供了*nix选项。

我可以在Windows上本地运行Redis吗?


当前回答

更新

如果你有Windows Linux子系统(WSL),本机在Windows 10和Windows Server 2019上,你可以按 Ogglas回答

或者按照这些说明在微软Windows上运行Redis数据库

Turn on Windows Subsystem for Linux In Windows 10, Microsoft replaced Command Prompt with PowerShell as the default shell. Open PowerShell as Administrator and run this command to enable Windows Subsystem for Linux (WSL): Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux Reboot Windows after making the change — note that you only need to do this once. Launch Microsoft Windows Store start ms-windows-store: Then search for Ubuntu, or your preferred distribution of Linux, and download the latest version. Install Redis server Installing Redis is simple and straightforward. The following example works with Ubuntu (you'll need to wait for initialization and create a login upon first use): sudo apt-add-repository ppa:redislabs/redis sudo apt-get update sudo apt-get upgrade sudo apt-get install redis-server Please note that the sudo command might or mightn't be required based on the user configuration of your system. Restart the Redis server Restart the Redis server as follows: sudo service redis-server restart Verify if your Redis server is running Use the redis-cli command to test connectivity to the Redis database. $ redis-cli 127.0.0.1:6379> set user:1 "Ben" 127.0.0.1:6379> get user:1 "Ben" Please note: By default, Redis has 0-15 indexes for databases, you can change that number of databases NUMBER in redis.conf. Stop the Redis Server sudo service redis-server stop

来源:如何在Windows上安装Redis


我找到了一个在Windows下安装Redis的更简单的方法

下载最新的Redis .msi文件

https://github.com/MSOpenTech/redis/releases

后安装。Redis服务已经安装,我们可以从服务管理器中操作它

其他回答

在Windows系统上安装Redis遵循以下步骤:

访问以下链接之一:

https://github.com/MSOpenTech/redis/releases(推荐) https://github.com/rgl/redis/downloads

下载MSI文件。 按照安装向导在您的系统上安装该程序。(不要更改安装路径为“C:\Program Files\Redis”) 在开始菜单上搜索“编辑系统环境变量” 点击“环境变量”按钮 选择“路径”,点击“编辑” 现在点击“新建” 粘贴C:\Program Files\Redis(如果在安装时更改了路径) 点击“ok”,“ok”和“ok”

现在打开终端(命令提示符)并运行redis-cli

好吧,我得到一些错误打开redis-server(它一直工作得很好,直到现在,但不确定什么是错误的,所以弄清楚并将更新这个答案)

在这里可以找到最新的Redis版本(后面只有几个小版本)。这个存储库为您提供了3.2.100版本(当前是3.2),而投票最多的答案只提供了2.4.6版本,最后一次更新是在2年前。

安装很简单:只需将存档中的所有内容复制到任何文件夹中,然后运行redis-server.exe来运行服务器,再运行redis-cli.exe通过shell连接到该服务器。

如果你有Windows Linux子系统(WSL),本机在Windows 10和Windows Server 2019上,你可以这样做:

设置WSL:

To enable Windows Subsystem for Linux, follow the instructions on Microsoft Docs. The short version is: In Windows 10, Microsoft replaces Command Prompt with PowerShell as the default shell. Open PowerShell as Administrator and run this command to enable Windows Subsystem for Linux (WSL): Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux Reboot Windows after making the change—note that you only need to do this one time. Download and install one of the supported Linux distros from the Microsoft Store. Ubuntu works fine. Note that Ubuntu 20.04 LTS may give you some trouble because of a known issue with the realtime clock (as of August 2020). Choosing Ubuntu 18.04 LTS instead avoids that issue.

安装和测试Redis:

Launch the installed distro from your Windows Store and then install redis-server. The following example works with Ubuntu (you’ll need to wait for initialization and create a login upon first use): > sudo apt-get update > sudo apt-get upgrade > sudo apt-get install redis-server > redis-cli -v Restart the Redis server to make sure it is running: > sudo service redis-server restart Execute a simple Redis command to verify your Redis server is running and available: $ redis-cli 127.0.0.1:6379> set user:1 "Oscar" 127.0.0.1:6379> get user:1 "Oscar" To stop your Redis server: > sudo service redis-server stop

来源:

https://redislabs.com/blog/redis-on-windows-10/

https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux

从历史上看,微软有一个redis的Windows移植版本,它以redis -64的形式发布,为Windows提供了一个完整的redis发行版。

微软的移植版本现在已被弃用,但已经出现了一些替代方案来填补这一空白:

Memurai是Redis-64弃用页面上官方推荐的替代方案;它是一个带有免费开发者层的商业产品,由Janea Systems维护 Redis-windows是另一个非官方的端口,它也存在


此版本包括Redis -server.exe (Memurai上的Memurai .exe)应用程序,在您的windows机器上运行Redis实例作为服务,以及Redis -cli.exe (Memurai上的Memurai -cli.exe),您可以使用它与任何Redis实例进行交互。

RGL存储库历史上被列为Redis的替代Windows端口,但这个存储库已经有一段时间没有维护了,并且实现了比微软端口更老的Redis版本。

今天我知道这4个选择:

第一个是tporadowski/redis上的开源分支,提供了与版本5的兼容性(版本6正在开发中)。

第二个是memurai(付费),与版本5兼容,支持和一个免费版本的开发。

第三个是最近发布的zkteco-home/redis-windows,它提供了与版本7的兼容性,但不是开源的。

也可以选择通过WSL运行。但是我不建议在生产环境中使用它。