Redis on Windows – Save RDB but Not Able to Persist

Posted by in IT, Tutorial

TL;DR: My windows service wasn’t installed properly. Change the config file to point the DB to an accessible directory and reinstall the service.

When trying to build a perioduc Celery task, I got the following error with Redis on Windows (running as a windows service):

redis.exceptions.ResponseError: 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.

This is quite unfortunate because the error doesn’t show at the very beginning, but only after about 5 mins on my computer.

The error obviously occurs because Redis can’t save the database snapshot. This can be tested with the following steps:

  1. Restart the service
  2. Execute the info command with redis-cli

    which will produce an initial result:

  3. Trigger a save

  4. Show the command again

    you can see the rdb_last_bgsave_status:err status, which means the DB could not have been saved

To fix this, go to your REDIS installation (mine is on C:\ProgramData\chocolatey\lib\redis-64 because I’ve installed it via chocolatey) and:

  1. Uninstall the windows service

  2. Edit the database directory to somewhere accessible (in redis.windows-service.conf)

    while replacing [myuser] with your relevant user and creating the C:/Users/[myuser]/tmp directory

  3. Install the service (again)

  4. Start the service

Now, the service should work. If not, then look in the Event Viewer, Applications and Services Logs > redis for more details.

HTH,


A little experiment: If you find this post and ad below useful, please check the ad out :-)