Redis started its life in Linux environment and to this date, it is officially supported only in Linux environment. However, the good folks at Microsoft had started a new division with the sole purpose of porting such useful products to Windows environment and let developers use them with confidence and with the support of Microsoft behind them. Even though that division has now merged back into Microsoft, engineers at Microsoft continue to make contributions to ported projects.
With the 64 bit architecture becoming the de-facto standard in commodity computers, open source contributors and organizations around the world have started to focus on releasing binaries for 64 bit architectures. That leaves people like me who are living perfectly fine life with their old trusty computers having 32 bit processors powering them. The silver lining in this scenario, is that if you have access to the source code of a product, then you can compile it for 32 bit architecture and then use it.
This article shows how to download Redis source code, compile it using Visual Studio for a 32 bit architecture and then run it in a Windows environment.
If you are a .Net developer, chances are that you have for majority of your professional life, written code on Windows platform, for Windows platform. On top of that if you have an old computer powered by a 32 bit processor, then you are striving to find ways to learn the new and up-coming technologies, such as NoSQL databases – MongoDB, Redis etc. which primarily have been released for 64 bit architectures.
I have been working with Redis since the past couple of months now and started learning Redis on my personal laptop which at the time of writing this article is 8 years young. This sometimes leaves me in a bit of a lurch as the newer projects and products are mainly focusing on releasing for 64 bit architectures. Well, all is not lost if you are willing to put up a little fight and compile the source code yourself, if it is available.
Thankfully Microsoft recognized that .Net developers should not get left behind when it comes to awesome products like Redis, just because they are not available to be run in the Windows environment, and hence they created a dedicated entity, Microsoft Open Tech Group devoted to porting these technologies in the Windows environment, and further the collaboration with the open source community. Redis is one of the projects that the group is handling at the moment.
Alright, so let’s run Redis on Windows in 32 bit architecture. Pre-requisite for accomplishing this is the newest version of Visual Studio 2013 with update 5, as without update 5, the process might not work successfully. If you do not have a paid version of Visual Studio, Community Version which is available for free here will also work.
1. Head over to Microsoft Open Tech Group’s Redis GitHub page for version 3.0 and download the source code available as a zip file.
2. Unzip the code in a folder in C drive. Make sure that the folder name in which the source code is housed bears a name with no space or special character.
3. Open the solution located in the msvs folder in Visual Studio.
4. Open the solution’s properties and go to the configuration manager and change the “Active solution configuration” to Release and “Active solution platform” to x86.
5. Now build the solution. Note there will be a few warnings that’ll come up, but ignore them.
6. Once the build completes, you will notice that there will be a new folder named “Win32” that would have gotten created. Inside this folder will be another folder “Release”. Release folder contains the final build and the executable files that we can use to run and learn Redis.
7. Locate the file “redis-server.exe” and execute it. It should come up looking something like shown here. This is the Redis server which by default listens on IP address 127.0.0.1 and port 6379.
8. Locate the file “redis-cli” and execute it. It should come up looking something like shown here. This is Redis command line interface and by default it sends commands on the address and port of 127.0.0.1 and 6379 respectively.
Lo and behold, we have Redis running in 32 bit Windows environment. Thanks to the brilliant folks at Microsoft for porting this valuable piece of technology to Windows environment.