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

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


当前回答

如果你想在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.

其他回答

我在https://github.com/mythz/redis-windows上提供了在windows上运行Redis的2种最流行的安装说明和下载,展示了如何:

使用Vagrant运行最新的稳定版本的Redis VirtualBox虚拟机。 下载并运行微软Redis的原生Windows移植

如果你想在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的两种最简单的方法

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。

你可以通过以下步骤在windows中安装redis。

下载Redis zip文件。点击这里! 解压zip文件到准备好的目录。 运行redis-server.exe,可以通过单击直接运行redis-server.exe,也可以通过命令提示符运行。

成功运行redis-server. exe后,运行redis-cli.exe。您可以通过运行redis-cli.exe test来访问它并测试命令 PING命令用于检测连接是否存在。

如果你有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