X

Intro to Redis for .NET Developers – Installing Redis on Windows

Redis

What is Redis – Installing Redis on Windows

Redis (REmote DIctionay Server) is a very popular open-source, networked, in-memory, key-value data store, sometimes referred to as a data structure server which also comes with optional durability. Redis is well known for high performance, flexibility, provides a rich set of data structures, and a simple straightforward API. The programming language Redis is written in is ANSI C.

The development of Redis has been sponsored by Pivotal since May 2013; before that, it was sponsored by VMware. According to the monthly ranking by DB-Engines.com, Redis is the most popular key-value store. Redis officially runs on Linux and not officially supported on Windows but MS Open Tech has been working with the Redis community to build a production-ready Windows port of Redis, including 64-bit support, an installer for Windows Azure, NuGet support, and much more.

In this series of post I will introduce Redis and it basic functionality using C# and node.js sample code.

To start off lets try to get Redis running on our Windows machine first. We will need to download the MSI from MS Open Tech, the latest version provided by MSOpenTech is 3.2.100 released in 2016.

This is an old version of Redis, I would not suggest installing Redis this way. The recommended way is to use Docker or use the Windows Subsystem for Linux Ubuntu environment

Windows Installation

Launch the msi and follow through the process of the install. Screenshot are attached below:

Install Redis Part 1
Install Redis Accept License
Install Redis, default location
Install Redis, default port
Installation
Install Progress
Install Complete

Linux Install

If you wish to run the latest version 5.0.3 of redis then you will need to install it on a Linux system. The following commands shows how to install redis on a Linux System (Ubunutu)

//Ubuntu 
$wget http://download.redis.io/releases/redis-5.0.3.tar.gz
$tar xzf redis-5.0.3.tar.gz
$cd redis-5.0.3
$make
$make test
$make install
$cd utils
$chmod +x install_server.sh
$./install_server.sh

//start and stop service by
$sudo service redis_6379 start
$sudo service redis_6379 stop

Ubuntu on Windows Install

There is also another option of installing on your windows machine that is using Windows Subsystem for Linux. One can run Ubuntu on Windows 10 as a subsystem. In order to enable Linux on Windows 10 you will need to run these commands first.

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

Then you can download the Ubuntu version you wish on the Windows Store. Next you can install Redis by launching the ubuntu prompt, the steps are listed below.

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

install-redis-windows-ubuntu

Validating installation

Once installed on windows or linux we can use the redis-cli to verify if redis is running.
On windows launch your prompt and go to C:\Program Files\Redis
run redis-cli.exe and if you are on Linux just simply run redis-cli

Run these commands, to set and get values

127.0.0.1:6379>SET test 1234
127.0.0.1:6379>GET test
"1234"
127.0.0.1:6379>quit

The end result should look something like this.

Redis Prompt

If you are having issues with connecting to redis, check out if redis is running, use the redis-server.exe to verify.

Summary

We have learned how to install redis in part 1 series of Redis for .NET Developers. in the upcoming post, I will go through the more details of redis.

Taswar Bhatti:
Related Post