DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workkloads.

Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Scaling in Practice: Caching and Rate-Limiting With Redis and Next.js
  • Integrating Redis With Message Brokers
  • Build a Data Analytics Platform With Flask, SQL, and Redis
  • Performance and Scalability Analysis of Redis and Memcached

Trending

  • Scalable System Design: Core Concepts for Building Reliable Software
  • Fixing Common Oracle Database Problems
  • Stateless vs Stateful Stream Processing With Kafka Streams and Apache Flink
  • Understanding and Mitigating IP Spoofing Attacks
  1. DZone
  2. Software Design and Architecture
  3. Microservices
  4. Running Redis on Windows 8.1 and Prior

Running Redis on Windows 8.1 and Prior

In part 1 of this ''Redis on Windows'' series, I explain how to run Redis on Windows 10 via the Windows Subsystem for Linux (WSL).

By 
Dave Nielsen user avatar
Dave Nielsen
·
Aug. 21, 18 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
25.7K Views

Join the DZone community and get the full member experience.

Join For Free

It's no secret that more developers code on Windows than any other OS. Every year, Stack Overflow shares its developer survey, and every year on Windows so you can develop applications that use Redis. Even if you access Redis remotely you still need a Redis client compiled for your local Windows machine (ex: Windows is the most popular OS for development, and Visual Studio is the most popular IDE. Of course, there are many ways to slice the data, but it suffices to say A LOT of you reading this post are using Windows right now. What isn't obvious, however, is how to install today, there is one way to develop with Redis natively on Windows 8.1 (and earlier versions of Windows), and that is with an unsupported port of Redis 3.2.1 for Windows. Redis Enterprise Cloud).

In part 1 of this "Redis on Windows" series, I explain how to run Redis on Windows 10 via the Windows Subsystem for Linux (WSL). In this post, I explain how to run Redis on earlier versions. In a future post, I will explain how to run Redis in a Docker container.

Port of Redis 3.2.1 for Windows

Officially, Redis is not supported on Windows. There is, however, a 3.2.1 version of Redis that was ported to Windows by MSOpenTech. It's over two years old and has some drawbacks, so the link from the redis.io Downloads page has been removed. That said, newer versions of Redis are backward compatible, so if you don't need new commands, then this 3.2.1 version of Redis might work for your development purposes.

Note: There have been many security fixes and other improvements since version 3.2.1, so I highly recommend against running older versions of Redis in production. This article expects that you want to run Redis on your developer machine for development purposes only. As always, you should develop your code on a non-open, trusted network that is behind a firewall.

Download, Install, and Run Redis 3.2.1 Port for Windows

  1. Visit the archived MSOpenTech Redis Github repository at https://github.com/MicrosoftArchive/redis/.
  2. Scroll down to the "Redis on Windows" section and click on the release page link.
  3. Find the latest version (currently 3.2.100)
  4. Download and run the .msi file and walk through the Setup Wizard instructions. Accept the Wizard's default values, but make sure to check the "Add the Redis installation folder to the Path environment variable" checkbox. Option #2: If you are unable to run the Setup Wizard, then follow these steps to install via .zip file. (Note: You may also download the forked Redis source code and build it to run on your version of Windows, but these steps will not be covered in this blog post):
      1. Download the .zip file to your hard drive.
      2. Unzip the files into any location, such as 'C:\Program Files\Redis\'.
      3. Follow these additional steps to complete the installation of Redis (Note that these steps are for Windows 7 Professional; other versions may require different steps):
        1. Add the path of your Redis folder as a Windows "environment variable."
          1. Open your "Control Panel" application and search for "Edit the system management variables."
          2. Open the "Environmental Variables" window.
          3. Under "User Variables," find the variable named "Path" and click "Edit."
          4. Add "C:\Program Files\Redis\" to the end of the variable value and click "OK."
          5. If the Path variable doesn't exist, then click "New," add "C:\Program Files\Redis\" and click "OK."
        2. Install Redis as a Windows Service.
          1. Open your Command Prompt (ex: cmd.exe).
          2. From your Redis folder (ex: C:\Program Files\Redis\) run the following command:
            > redis-server --service-install
            Note: To uninstall Redis as a Windows Service type:
            > redis-server --service-uninstall
  5. To run Redis 3.2.1 port on Windows 8.1 (or previous editions):
    1. Open your Command Prompt (ex: cmd.exe) and type:
      > redis-server --service-start
    2. The Redis API will create a default Redis, which is ready to accept connections on port 6379. You may now connect to it with the redis-cli.exe file. Note: To save and stop the Redis database, type:
      > redis-server shutdown save
      Note: To shut down the Redis server, type:
      > redis-server --service-stop
  6. Secure your Redis
    1. Security is very important, especially while connected to the Internet. Redis 3.2 is the first version that addresses security by default. This version and versions after it have protected mode until the user specifies a password or an IP address. This means that you will only be able to access your Redis from your local machine using 127.0.0.1 or localhost. Nonetheless, it is always a good idea to specify a password and the network addresses which you want to access your Redis.
      • Password: The password is set by the system administrator in clear text inside the redis.conf file. Open the file, uncomment the #, and change "mypassword" to a very strong and very long value.
        requirepass mypassword
      • Network address: It is also possible to bind Redis to your laptop by adding a line like the following to your redis.conf file:
        bind 127.0.0.1
    2. You should also read the security page on redis.io to identify the right security configuration for your situation.

Connect to Redis for Windows

  1. Open your Command Prompt (ex: cmd.exe)
  2. From your Redis folder (ex: C:\Program Files\Redis\) run the following command:
    > redis-cli ping
    You will get a response: "pong" if the server is running.
  3. If you need to connect to Redis across a network, you must type the hostname (or IP address), such as:
    > redis-cli -h redis15.local.net -p 6739 -a mypassword ping  
    (or > redis-cli -h 123.456.789.012 -p 6739 -a mypassword ping)
  4. You can also specify a password, such as:
    > redis-cli -a mypassword ping
  5. To save keyboard clicks, you can establish a continuous session with the Redis server by typing:
    > redis-cli -a mypassword 

    Now you can just type your command, such as:
    > ping
  6. For memory and security reasons, it is a good idea to shutdown Redis when not in use. To save your data and stop Redis, type:
    > redis-cli -a mypassword shutdown save

Summary

Now that you have Redis running on your developer machine, you'll want your application to talk to Redis. Check out the Redis clients section on redis.io for a list of Redis client libraries. In particular, look at the C# clients ServiceStack.Redis and StackExchange.Redis.

Redis (company)

Published at DZone with permission of Dave Nielsen, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Scaling in Practice: Caching and Rate-Limiting With Redis and Next.js
  • Integrating Redis With Message Brokers
  • Build a Data Analytics Platform With Flask, SQL, and Redis
  • Performance and Scalability Analysis of Redis and Memcached

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!