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:
- Restart the service
- Execute the info command with
redis-cli12redis-cli info |grep bg
which will produce an initial result:123456rdb_bgsave_in_progress:0rdb_last_bgsave_status:okrdb_last_bgsave_time_sec:1rdb_current_bgsave_time_sec:-1aof_last_bgrewrite_status:ok
- Trigger a save
123$ redis-cli bgsaveBackground saving started
- Show the command again
1234567$ redis-cli info | grep bgrdb_bgsave_in_progress:0rdb_last_bgsave_status:errrdb_last_bgsave_time_sec:0rdb_current_bgsave_time_sec:-1aof_last_bgrewrite_status:ok
you can see the
rdb_last_bgsave_status:errstatus, 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:
- Uninstall the windows service
- Edit the database directory to somewhere accessible (in redis.windows-service.conf)
[myuser]with your relevant user and creating the
Install the service (again)12./redis-server --service-install redis.windows-service.conf --loglevel verbose
- Start the service
Now, the service should work. If not, then look in the Event Viewer, Applications and Services Logs > redis for more details.
A little experiment: If you find this post and ad below useful, please check the ad out :-)