Installing Redis on a Windows Workstation

Use these instructions at your own risk. As with all installations you should become familiar with the software and ensure it is setup and secured correctly.

Recently I’ve been using Redis on some projects to provide a really fast and reliable in-memory, distributed cache and datastore. It’s easy to use and has been a blast to learn. I found a good book to get started learning about the features of Redis was Redis in Action by Josiah L. Carlson. It provides a good overview and really helped me learn a lot of the features and possible uses for Redis.

Since I do a lot of work in .NET I wanted to have a local installation on my development machine to experiment with and use during local debugging. I was surprised how easy it was to install and setup locally.

Installation

MS Open Technologies has created a version that runs on Windows for use in Azure and is available for download and running on a local Windows environment. You can install it from nuget or use chocolatey.

nuget:

PM > Install-Package Redis-64

chocolatey:

cmd> cinst redis-64

If you’re not familiar with chocolatey it’s like apt-get for Windows and uses nuget packages. It’s great for installing Windows applications, so if you haven’t used it yet, you should definitely check it out.

Running Redis as a service:

I setup Redis to run as a service because that way it starts automatically and is always available. You don’t have to do this, but it keeps you from having to start the server each time you go to use Redis. To install it as a service, MSOpenTech has made it really easy:

cmd> redis-server —service-install

Now that you have it installed and running as a service, just make sure it’s started (service manager). That’s it! Redis is installed and running.

Using Redis from the command line:

cmd> redis-cli

— set a key of redis to value of awesome, get it, and delete it
127.0.0.1:6379> set redis awesome
OK
127.0.0.1:6379> get redis
“awesome"
127.0.0.1:6379> del redis
(integer) 1

Securing your local version of Redis

You should make sure that your local version of redis is not visible from the network. Ensure that your firewall is blocking outside connections to its configured port. The default port is port 6379.

Its also a good idea on a local development machine to set it to only bind to the local loopback interface (127.0.0.1). In your redis.config file you would just uncomment the following line:

bind 127.0.0.1

You should also be set a strong password for Redis to make sure if it is ever accessed externally the password will not be as susceptible to a brute force attack.

There is more information available in the Redis documentation on securing and configuring / using Redis.

That’s it! Now you can configure your .NET applications to connect to your local version of Redis while you’re doing local development and debugging. Enjoy!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s