解决Redis服务错误一例听语音

Redis是很有效的一项服务,但是初学者会碰到很多问题,我希望这篇文章能够帮助到他们。

在运行Redis服务后,几分钟后抛出一个错误:

Failed Opening .rdb for saving:Permission denied.

Background saving error

根据错误提示,是Redis后台保存时遭遇了权限问题。


  1. 在终端中打开redis.conf文件,redis.conf文件通常是在/usr/local/bin  目录下

    $ cd /usr/local/bin

    $ vim redis.conf

  2. 2

    在redis.conf文件中搜索dir的配置项,dir配置项是rdb文件保存的目录,

    # The working directory.

    ## The DB will be written inside this directory, with the filename specified# above using the 'dbfilename' configuration directive.

    # # The Append Only File will also be created inside this directory.

    # # Note that you must specify a directory here, not a file name.

    dir ./

    此处./表示redis-server所在的目录,查看该目录的权限

  3. 3

    查看权限

    $ ls -l

    ....

    -rw-r--r--.    1    root     root     35    Aug    4    00:59    dump.rdb

    ....

    此处dump.rdb文件root账号是有读写权限,而同为管理员组的其他账号之后读权限,所以造成了上诉问题

  4. 4

    修改文件权限:

    $ chmod g+w dump.rdb


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值