Redis on Windows - Save RDB but Not Able to Persist
1 min read

Redis on Windows - Save RDB but Not Able to Persist

Redis on Windows - Save RDB but Not Able to Persist

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

    redis-cli info |grep bg

    which will produce an initial result:

  3. Trigger a save

    redis-cli bgsave
    # Background saving started
  4. Show the command again

    redis-cli info | grep bg

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

    ./redis-server --service-uninstall
  2. Edit the database directory to somewhere accessible (in

    # ...
    dir C:/Users/[myuser]/tmp
    # ...

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

  3. Install the service (again)

    ./redis-server --service-install --loglevel verbose
  4. Start the service

    ./redis-server --service-start

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