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

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


当前回答

读到一些用户在虚拟机中运行Redis,这让我想起了Redis团队的建议:

Redis在虚拟机上运行速度较慢。虚拟化的代价是相当高的,因为许多常见的操作。(…)更喜欢在物理机上运行Redis,特别是如果你喜欢确定性延迟。在最先进的管理程序(VMWare)上,通过物理网络对虚拟机进行红色基准测试的结果几乎是物理机器的2倍,在系统和中断上花费了大量的CPU时间。

其他回答

以下是我通过Windows子系统for Linux在Windows 10 Pro(1709)上安装Redis 4.0.8的步骤:

in home/user/
   01 wget http://download.redis.io/releases/redis-4.0.8.tar.gz
   02 tar xzf redis-4.0.8.tar.gz
   03 cd redis-4.0.8/
   04 sudo apt-get install make
   05 sudo apt-get update
   06 sudo apt-get install gcc
   07 cd deps
   08 make hiredis jemalloc linenoise lua geohash-int
   09 cd ..
   10 make

如果您有一个最新的环境,您可以跳过几个步骤。

如果你想在Windows服务器上安装mopentech最新的Redis端口,由Windows Service监视,而不需要自己构建任何东西,请继续阅读。

MSOpenTech's seems to be the only port that is actively trying to keep up with the latest and greatest Redis. They claim it is production-ready, but they haven't exactly packaged it up neatly for installation on a server, especially if you want to run their RedisWatcher service to keep an eye on it, which is recommended. (I tried building RedisWatcher myself per their instructions, but the required Wix Toolset managed to mess up my system pretty good. I won't go into it.) Fortunately they've provided all the binaries you need, just not all in one place. From the README:

到目前为止,RedisWatcher还没有延续到2.6版本。然而,这 不应该受到Redis版本和2.4中的代码的影响 分支应该与Redis 2.6二进制文件一起工作。

因此,您需要从两个分支下载二进制文件,以获得所有必要的位。话不多说,下面是步骤:

Download and extract the Redis binaries from the 2.6 branch Copy all extracted binaries to c:\redis\bin Create another folder at c:\redis\inst1 Download and extract the RedisWatcher binaries from the 2.4 branch Run InstallWatcher.msi. This should create a Windows service called Redis watcher. Open up the Windows Services console and start the Redis watcher service. (optional) RedisWatcher should have installed to C:\Program Files (x86)\RedisWatcher. There you'll find a config file called watcher.conf, which you can edit to set up additional instances, use different paths than I specified in steps 2 & 3, etc. You will not need to restart the service for changes to take effect.

目前还没有windows版的Redis。(只有一些旧版本可用)

但是你可以使用WSL(Windows Subsystem for Linux)安装最新版本,参考以下来自Redis Labs的博客:

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

我认为这是在Windows上运行Redis的两种最简单的方法

1 -本地(更新)端口的Windows

如选项3所述,运行微软的Redis本机端口:

下载redis原生64位Windows端口redis-latest.zip wget https://github.com/ServiceStack/redis-windows/raw/master/downloads/redis-latest.zip 解压redis64-latest.zip到任何文件夹,例如在c:\redis 使用本地配置运行redis-server.exe cd c: \复述 redis-server.exe redis.conf 运行redis-cli.exe连接到你的redis实例 cd c: \复述 redis-cli.exe

2 -与流浪者

你可以在Windows上用Vagrant使用Redis,如下所述:

在Windows上安装Vagrant 下载vagrant-redis.zip vagrant配置文件 wget https://raw.github.com/ServiceStack/redis-windows/master/downloads/vagrant-redis.zip 将vagrant-redis.zip解压到任意文件夹,例如c:\vagrant-redis 使用vagrant启动Virtual Box VM: cd c: \ vagrant-redis 流浪汉了 这会在Virtual Box中启动一个新的Ubuntu VM实例 自动安装并启动最新的稳定版本的redis。

由于mopentech的Redis端口不再维护-任何对Redis Windows本机端口感兴趣的人现在可以从这里获得4.0.14和5.0.10版本:https://github.com/tporadowski/redis/releases。 这个分叉是MSOpenTech的最新3.2.100版本和antirez/redis的4.0.14/5.0.10版本的合并,并修复了一些错误。