Redis:无法打开 .rdb 进行保存:权限被拒绝 [英] Redis: Failed opening .rdb for saving: Permission denied
问题描述
我在 ubuntu 12.04 上使用 ubuntu apt-get 安装了 redis 服务器 2.8.
I have a redis server 2.8 installed using ubuntu apt-get on ubuntu 12.04.
我从其他数据库复制了 dump.rdb.现在,当我尝试启动新服务器时,我不断得到:
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?
推荐答案
您应该检查您的 redis.conf 文件以查看 dir 和 dbfilename 中的权限.如果dbfilename中指定的文件位于dir路径中指定的路径中,并且权限也正确.那么问题应该得到解决.
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.
附言
要查找redis.conf
文件位置,可以使用#ps ax |grep redis
检查.通常它会作为输入文件传递给redis-server
.
To find the redis.conf
file location, you can use the #ps ax | grep redis
to check. Usually it will be passed to the redis-server
as input file.
dir权限:755
,dbfilename,644
有时还需要使用top
命令来检查redis-server
的user:group
和dir 是一致的.即 redis-server
由 redis:redis 运行,但 dir 在 root:root 下.在这种情况下,你需要chown redis:redis -R dir
.
Sometimes you also need to use top
command to check whether the user:group
of the redis-server
and the owner of dir are consistent. i.e. The redis-server
is running by redis:redis, but the dir is under root:root. In this case, you need to chown redis:redis -R dir
.
这篇关于Redis:无法打开 .rdb 进行保存:权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!