In this tutorial, you will learn some tips and tricks to help you diagnose Redis issues. This post came about as a client decided to use Redis as their cache provider to improve the speed of their website 🏃💨, 🚗💨.

This first tip is for anyone trying to run Redis after installing it using Chocolately. As part of the Ci/Cd process, the idea was to use Chocolatey to automatically install Redis on a virtual server, if it did not exist.

After installing Redis and starting it successfully, after about 4-5 minutes the server would stop taking connections with this error:


2016-12-09 11:07:37 : Connection: 127.0.0.1 > Response received : -MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled.

Please check Redis logs for details about the error. For reference, I was using Redis Desktop Manager and also telneting to '6379' (the Redis port) in order to test my Redis connection. In today's post I'm going to cover the process I went through in order to fix Redis.


Chocolately will install Redis here, C:\ProgramData\chocolatey\lib rather than C:\Program Files\Redis. Redis uses a Windows service to start. By default, the Redis Windows Service will expect Redis to live in C:\Program Files\Redis. This is why Redis was failing to start. To fix the issue, you need to change the Redis service to point to the Chocolatey folder. You can do this within the registry.

redis_windows_troubleshooting_1

Open the registry editor by typing Regedit in Run. After the editor has opened, navigate to:

Change the value of ImagePath to the new Chocolatey location.  After making the change, you will need to restart the Redis service before it will be used.  This can be done from the services screen in Windows:

redis_windows_troubleshooting_2

Find the Redis service, right-click on it to select Refresh then right-click on the service again and choose Restart. My Redis server now ran, but Redis still didn't work 😞

Permissions and Redis

Redis has its own set of logs. Checking the Redis logs should be the first go-to step for any Redis issue you encounter. In the logs, I bumped into an error. As Redis had been completely installed using a build script, the correct folder permissions had not been applied. When I tried to open the Redis log folder I was presented with a Windows dialogue complaining about permissions. To read the logs, I had to grant the Redis folder the correct Windows folder permissions. First I wanted to check the account the Redis Service was using:

redis_windows_troubleshooting_3

The path to find the services area is shown below: 

To find the Windows account the Redis Service runs under, right-click on it and select properties:

redis_windows_troubleshooting_4

In the dialogue that loads, open the Log Ontab. From here you can see which account is being used.  In my case, this was Network Service.  The next step was to make sure the Network Service account had read/write permissions to the folder where the Redis files lived.

To add permissions, navigate to the Redis folder in file explorer (remember my files were located here C:\ProgramData\chocolatey\lib). Right-click on the Redis folder, select PropertiesSecurity. Next, click the Edit button:

redis_windows_troubleshooting_5

Mine didn't, so I added it with the correct permissions. This fixed the permissions error when I tried opening the Redis log folder, however, my problem was not fixed 😞. Redis still wasn't working and what's worse, nothing was still being written to the Redis logs 🤯

TIP: If you do not know where your Redis logs are located you can find this out. The location is defined within redis.windows-service.conf and redis.windows.conf located within your Redis directory 💥💥💥

By default, my Redis logs were being written to in-memory. I wanted my logs to be written to disk so I changed this within the config file:

After resetting the Redis Windows Service again, a log file called server_log.txt was created within the Redis directory. It also started updating 🥳🥳🥳. Following the process outlined in this guide, fixed my issue locally. I assume as Redis couldn't read from the folder correctly it caused it to crash, which makes sense. If you use Chocllately be aware it will instal Redis in a non-standard way.

⚠️ I should also probably note, that I needed to create an inbound rule on the servers Windows Firewall for port 6703 for this to work as well! ⚠️

redis_windows_troubleshooting_6

Fixing Redis To Work With Remote Clients

My Redis client was now working locally, however, I still couldn't connect to our remote Redis. When installed by default, Redis only allows localhost browsing. To enable remote clients to view the Redis instance, you need to update your credit.windows-service.conf and redis.windows.conf files to allow remote connections. You can do this by changing the files from this:

To... this!

This change allowed me to remotely connect to my Redis database with everything working as expected


There are probably hundreds of issues that you may encounter when you install Redis for the first time. For my issue, unexpected install locations, combined with incorrect folder permissions caused my Redis to stop allowing connections after 5 minutes. To fix the issue I had to add the correct permissions. I also had to do some config tweaks to allow remote connection to Redis. The settings I listed above might not be best practice for security, but as this was only in a QA environment it didn't matter too much. If you are stuck with on-prem Redis then make sure the service is started as your first debugging step! Happy Coding 🤘