Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I run Redis on Windows?

Tags:

windows

redis

How do I run Redis on Windows? The Redis download page just seems to offer *nix options.

Can I run Redis natively on Windows?

like image 205
DaveHeller Avatar asked Jun 25 '11 09:06

DaveHeller


People also ask

Is Redis available for Windows?

Redis is supported by all common operating systems. The current version of Redis available for download is 3.2. 100. You can download Redis for Windows from here.

How do I run Redis locally?

To start Redis client, open the terminal and type the command redis-cli. This will connect to your local server and now you can run any command. In the above example, we connect to Redis server running on the local machine and execute a command PING, that checks whether the server is running or not.

How do I know if Redis is installed?

you can do it by this way. $redis = new Redis(); $redis->connect('127.0. 0.1', 6379); echo $redis->ping(); and then check if it print +PONG , which show redis-server is running.


12 Answers

Historically, Microsoft had a Windows port of redis, which was released as Redis-64, which offers a full distribution of redis for Windows.

The Microsoft port is now deprecated, but some alternatives have sprung up to fill that void:

  • Memurai is the alternative officially recommended on the Redis-64 deprecation page; it is a commercial offering with free developer tier, maintained by Janea Systems
  • redis-windows is another unofficial port, which also exists

This release includes the redis-server.exe (memurai.exe on Memurai) application that runs a Redis instance as a service on your windows machine, as well as redis-cli.exe (memurai-cli.exe on Memurai) which you can use to interact with any Redis instance.

The RGL repository has historically been listed as an alternative Windows port for Redis, but this repository has not been maintained for some time and implements an older version of Redis than the Microsoft port.

like image 188
serg Avatar answered Oct 02 '22 23:10

serg


Update

If you have Windows Subsystem for Linux (WSL), natively on Windows 10 and Windows Server 2019 you can do it per Ogglas answer


I found one more simple way to install Redis under Windows

Download the latest Redis .msi file from

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

after installation. The redis service is installed, we can operate it from Service manager

enter image description here

like image 22
zangw Avatar answered Oct 03 '22 00:10

zangw


If you want to install MSOpenTech's latest port of Redis, on a Windows server, watched over by a Windows Service, without having to build anything yourself, read on.

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:

So far the RedisWatcher is not carried over to 2.6. However this should not be affected by the Redis version, and the code in the 2.4 branch should work with the Redis 2.6 binaries.

So you'll need to download binaries from 2 branches in order to get all the necessary bits. Without further ado, here are the steps:

  1. Download and extract the Redis binaries from the 2.6 branch
  2. Copy all extracted binaries to c:\redis\bin
  3. Create another folder at c:\redis\inst1
  4. Download and extract the RedisWatcher binaries from the 2.4 branch
  5. Run InstallWatcher.msi. This should create a Windows service called Redis watcher.
  6. Open up the Windows Services console and start the Redis watcher service.
  7. (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.
like image 27
Todd Menier Avatar answered Oct 02 '22 23:10

Todd Menier


The most updated (only few minor releases behind) version of Redis can be found here. This repository provides you with 3.2.100 version (current is 3.2) whereas the most upvoted answer gives you only 2.4.6 version and the last update to the repo was 2 years ago.

The installation is straightforward: just copy everything from the archive to any folder and run redis-server.exe to run the server and redis-cli.exe to connect to this server through the shell.

like image 21
Salvador Dali Avatar answered Oct 03 '22 00:10

Salvador Dali


To install Redis for Windows

You can choose either from these sources

  1. https://github.com/MSOpenTech/redis/releases or
  2. https://github.com/rgl/redis/downloads

Personally I preferred the first option

  • Download Redis-x64-2.8.2104.zip
  • Extract the zip to prepared directory

  • run redis-server.exe or redis-server.exe --maxheap 2gb

enter image description here

  • then run redis-cli.exe

enter image description here

enter image description here

You can start using Redis now, please refer for commands

like image 44
Cristiana Chavez Avatar answered Oct 03 '22 00:10

Cristiana Chavez


Maybe its a little Late but, I was able to run Redis on Windows 10 Aniversary Update.
Windows 10 Aniversary Update Comes with Bash on Ubuntu on Windows, simply, it comes with bash.

Below are the two tutorial that I followed:

1- How to Install and Use the Linux Bash Shell on Windows 10
2- How To Install and Use Redis

Below is the image of running Redis.

Enjoy :)

Redis running on port 6379

like image 23
awebartisan Avatar answered Oct 02 '22 22:10

awebartisan


Go to the releases and you can get a ZIP file containing the relevant files as well as a Word document called RedisService.docx with the following instructions:

Installing the Service

--service-install

This must be the first argument on the redis-server command line. Arguments after this are passed in the order they occur to Redis when the service is launched. The service will be configured as Autostart and will be launched as "NT AUTHORITY\NetworkService". Upon successful installation a success message will be displayed and Redis will exit. This command does not start the service.

For instance:

redis-server --service-install redis.windows.conf --loglevel verbose

And then later, in the same document, another example:

The following would install and start three separate instances of Redis as a service:

redis-server --service-install -–service-name redisService1 –port 10001

redis-server --service-start --service-name 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

From what I can gather, this appears to be the new way forward rather than messing with a separate Windows service to monitor and restart the CLI.

like image 53
bbrown Avatar answered Oct 02 '22 23:10

bbrown


If you have Windows Subsystem for Linux (WSL), natively on Windows 10 and Windows Server 2019 you can do it like this:

Set up WSL:

  1. 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
    
  2. Reboot Windows after making the change—note that you only need to do this one time.

  3. 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.

Install and Test Redis:

  1. 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
    
  2. Restart the Redis server to make sure it is running:

    > sudo service redis-server restart
    
  3. 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"
    
  4. To stop your Redis server:

    > sudo service redis-server stop
    

Source:

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

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

like image 53
Ogglas Avatar answered Oct 03 '22 00:10

Ogglas


Download redis from Download Redis for windows

  • Then install it
  • open cmd with admin rights
  • run command net start redis

Thats it.

like image 37
Guru Avatar answered Oct 03 '22 00:10

Guru


You can use Memurai for Windows, a Redis-compatible cache and datastore for Windows, currently compatible with Redis 5. Memurai aims to fulfill the need for a supported Redis-compatible datastore on the Windows platform. At its core, it’s based on Redis source code, ported to run natively on Windows, and it’s designed to provide the level of reliability and performance required for production environments. Memurai is free for development and testing. You can learn more and download Memurai at https://www.memurai.com.

Alexis Campailla
CEO, Memurai

like image 32
Alexis Campailla Avatar answered Oct 02 '22 22:10

Alexis Campailla


MS Open Tech recently made a version of Redis available for download on Github. They say that it isn't production ready yet, but keep an eye on it.

Github repo

Download releases as MSIs

like image 31
JesseBuesking Avatar answered Oct 03 '22 00:10

JesseBuesking


There are two ways. You can use MSI installation file or do it manually:

First download the msi or the zip file:

You can download both files from here:

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


Watch video tutorial (video covers example of both installations)

See this installation video tutorial: https://www.youtube.com/watch?v=ncFhlv-gBXQ



Instruction - for those who can not YT at work:

You can download a moderately out-of-date precompiled version of Redis for 32-bit and 64-bit Windows thanks to Dusan Majkic from his GitHub page: https://github.com/dmajkic/redis/downloads. Go ahead and do that now.

After you download Redis, you’ll need to extract the executables from the zip file. As long as you’re using a version of Windows more recent than Windows XP, you should be able to extract Redis without any additional software. Do that now.

After you’ve extracted either the 32- or 64-bit version of Redis to a location of your choice (depending on your platform and preferences; remember that 64-bit Windows can run 32- or 64-bit Redis, but 32-bit Windows can only run 32-bit Redis), you can start Redis by double-clicking on the redis-server executable. After Redis has started, you should see a window similar to figure A.1.

src: https://redis.com/ebook/appendix-a/a-3-installing-on-windows/a-3-2-installing-redis-on-window/

like image 25
DevWL Avatar answered Oct 02 '22 22:10

DevWL