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

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


当前回答

you can install Redis by following this article: https://github.com/ServiceStack/redis-windows but for going straight, you can download it by this link: https://github.com/ServiceStack/redis-windows/raw/master/downloads/redis-latest.zip after downloading, go to the directory which you like to put your files,then extract the zip file, then open a command prompt and go to the directory where you extracted your file, then type "redis-server" and hit enter(for opening redis-cli open command and route to redis directory, but instead of "redis-server" execute "redis-cli").

其他回答

我不在windows上运行redis。与端口保持一致涉及太多的麻烦,并且它们总是落后于redis-stable一两个版本。

相反,我在为我运行redis的Vagrant虚拟机上运行redis。我把整个事情打包成一个简单的github repo,这样每个人都可以在没有太多麻烦的情况下获得乐趣。整个过程是自动构建的,所以不会出现混乱。我在这里写了详细的博客。

安装 Redis

窗户

⚫Windows 8.1及以前版本

Download Redis (msi) from the link https://github.com/MicrosoftArchive/redis/releases Run the installer Open the folder where Redis has been installed and Start redis-server to check if redis is working by clicking on redis-server Stop Redis server by typing SHUTDOWN SAVE or force quit by CTRL + C Open Start Type Environment Variables and click on edit environment variables and path Inside System variables, click on path In the next window click on new. Add a new path C:\Program Files\{Your Redis Version} Where Redis Version is the Redis version installed on your system For e.g. C:\Program Files\Redis-x64-3.2.100 Verify That Setup was Successful Check by typing redis-cli or redis-server

⚫ 视窗 10

Step Up WSL

a.以Administrator用户运行Windows Powershell

b.执行以下命令

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

c.修改完成后重新启动Windows

d.从windows商店https://www.microsoft.com/en-us/p/ubuntu-1804/9n9tngvndl3q?activetab=pivot%3Aoverviewtab下载Ubuntu发行版

安装和测试Redis

a.启动下载的发行版,执行如下命令

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install redis-server
redis-cli -v

注:如果安装有任何错误,请参阅本文。

以下是我通过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子系统for Linux(a.k.)在Windows 10上安装Redis。WSL2)。WSL2是一个兼容层,用于在Windows 10和Windows Server 2019上本机运行Linux二进制可执行文件。WSL2允许开发人员直接在Windows上运行GNU/Linux环境(包括命令行工具、实用程序和应用程序)。

按照下面的链接在微软Windows 10上创建Redis数据库https://developer.redislabs.com/create/windows

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

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

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