Debugging Windows Redis Server Issues

Recently, a client decided to use Redis as their cache provider. As part of the build process, the idea was to use Chocolatey to install it. After installing Redis, after about 4-5 minutes the server would stop taking connections with this error: 2016-12-09 11:07:37 : Connection: > 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.

 Debugging Redis

If you haven't tried to install Redis via Chocolately you can skip this section.  As I'd never tried to install Redis with Chocolately before, the first thing I tried was to install manually using the Windows installer, redis-2.4.6-setup-64-bit.exe, as I knew this worked.  After installing Redis manually, I tried to update the config, reset Redis but none of my changes were working.   Chocolately will install Redis in this location, 'C:\ProgramData\chocolatey\lib' rather than 'C:\Program Files\Redis'.  If you have a Redis Windows Service set-up and you want to point it to a different folder location, you will need to change it within the registry. redis_windows_troubleshooting_1 Open the registry editor by typing regedit in Run and Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services.  In here, change ImagePath to the new location.  After making the change you will need to restart the service.  To do this go to Start > Control Panel > Administrative Tools > Services. redis_windows_troubleshooting_2 Find the Redis entry, right-click on it to select 'Refresh' and then right-click again and choose 'Restart'.  My server was now running my tried and proven way of running Redis, but it still didn't work.

Permissions and Redis

Redis has logs to its own set-up logs.  After pointing my Redis service to the new file location, my next step was to see if any errors had been logged.  This is where I bumped into my first issue.  As the server had been completely set-up with a build script, when I tried to open the folder I was presented with a Windows dialog prompt moaning about permissions, so the first thing I had to do was grant the correct permissions.  First I wanted to check the account the Service was using. redis_windows_troubleshooting_3 I did this by right-clicking on the Redis Windows Service, in Control Panel > Administrative Tools > Services and selecting properties redis_windows_troubleshooting_4 In the properties dialog, click the 'Log On' tab and check which account is being used.  In my case, this was 'Network Service'.  On my Redis folder, C:\Program Files\Redis, right-click -> Properties -> Security - > Edit. redis_windows_troubleshooting_5 Then I made sure Network Service has read/write permission.  This got rid of the Windows error, however, nothing was still being written to the Redis logs.  If you don't know where your Redis logs are, the location is defined within and within your Redis directory.  My config looked like this: logfile "server_log.txt syslog-enabled yes syslog-ident redis I wanted my logs to be written to disk so I changed this to: logfile "" # syslog-enabled no # syslog-ident redis After resetting the Redis Windows Service, the log file 'server_log.txt' within the Redis directory started updating.  This process actually ended up fixing my issue locally. I'm guessing as Redis couldn't read to the folder correctly it caused it to crash, which makes sense. I should also probably note, that I needed to create an inbound rule on the servers Windows Firewall for port '6703'

Fixing Redis To Work With Remote Clients

My Redis client was now happily working locally, but I still couldn't connect to it remotely.  This was because the config files when installed by default, only allow localhost browsing.  To enable remote clients, you need to update your and from this: bind protected-mode yes to bind #protected-mode yes This then allowed me to remotely connect to my Redis database with everything working as expected

Debugging Redis Takeaway

There are probably hundred of issues you can come up against when you work with Redis.  For my issue, 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 Redis then I'd make sure the service is started.

submit to reddit

Jon D Jones

Software Architect, Programmer and Technologist Jon Jones is founder and CEO of London-based tech firm Digital Prompt. He has been working in the field for nearly a decade, specializing in new technologies and technical solution research in the web business. A passionate blogger by heart , speaker & consultant from England.. always on the hunt for the next challenge

Back to top