I have a redis server 2.8 installed using ubuntu apt-get on ubuntu 12.04.
I have copied a dump.rdb from an other database. Now when I try to start the new server, I constantly get:
[35763] 04 Mar 01:51:47.088 * 1 changes in 900 seconds. Saving...
[35763] 04 Mar 01:51:47.088 * Background saving started by pid 43313
[43313] 04 Mar 01:51:47.088 # Failed opening .rdb for saving: Permission denied
How can I solve this?
I spent some time on this until i realised that my cmd line session was running in the wrong drive :/. Just in case this might help anyone else!
My /lib/system/systemd/redis-server.service file contained the following:
My /etc/redis/redis.conf file stated that the database should be located in /data/redis
The systemd config file above effectively makes /data/redis read-only.
Once I changed the redis.conf file to read:
I stopped getting the error.
You should check your redis.conf file to see the permissions in dir and dbfilename. If the file named in the dbfilename which is located in the path specified in the dir path exists and the permission is also right. then the problem should be fixed.
Hope this will help someone.
P.S.
To find the
redis.conf
file location, you can use the#ps ax | grep redis
to check. Usually it will be passed to theredis-server
as input file.For the dir permissions:it should be
755
, for the dbfilename, it should be644
Sometimes you also need to use
top
command to check whether theuser:group
of theredis-server
and the owner of dir are consistent. i.e. Theredis-server
is running by redis:redis, but the dir is under root:root. In this case, you need tochown redis:redis -R dir
.For windows only : This means the user does not have permission for this. BY default owner of this file is NETWORK SERVICE, which has very limited access and need to changed(as per documentation)
solution :
go to ur redis folder.
right click --> go to properties--> security tab.
click on advanced.
click on Add to add ur user.
click on select a principal.
enter ur user (for eg GLOBAL\xxx).
click on check names and click on ok
give permissions to this user.
finally change the owner to this user.
If anyone encounters this again and doesn't have a problem upgrading, just upgrade your Redis installation to the latest version. I encountered this problem with
Redis 2.8.15
, and upgraded toRedis 2.8.22
that was available at the time of this writing. A sysadmin in my company assured me that this was a bug withRedis 2.8.15
, and the problem just went away after upgrading.