Redis: Failed opening .rdb for saving: Permission denied

后端 未结 13 1385
误落风尘
误落风尘 2020-12-05 02:00

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

相关标签:
13条回答
  • 2020-12-05 02:21

    The lock file in the log directory is what was causing this error for me. I was able to clear the error by deleting the lock file:

    rm /var/log/redis/lock.

    This happened when another system was restored to this one while redis was still running.

    0 讨论(0)
  • 2020-12-05 02:22

    Check the configuration 'dbfilename' in your redis.conf. Your redis running process have no write permission in the path.

    0 讨论(0)
  • 2020-12-05 02:23

    My /lib/system/systemd/redis-server.service file contained the following:

    ReadOnlyDirectories=/
    ReadWriteDirectories=-/var/lib/redis
    

    My /etc/redis/redis.conf file stated that the database should be located in /data/redis

    dir /data/redis
    

    The systemd config file above effectively makes /data/redis read-only.

    Once I changed the redis.conf file to read:

    dir /var/lib/redis
    

    I stopped getting the error.

    0 讨论(0)
  • 2020-12-05 02:25

    In my case all rights were correct(I mean that the most stared answer doesn't help me). BUT! Redis used an incorrect path to file. In config it was correct, but from rails-cli it returned '/proc'. This answer helped me - https://serverfault.com/questions/800295/redis-spontaneously-failed-failed-opening-rdb-for-saving-permission-denied

    Warning

    For exact question it doesn't matter, but my situation looked like someone hacked server. Link to explanation. So check your setup properly.

    0 讨论(0)
  • I had the same issue with redis used by Sidekiq in Rails application, rm -rf ./tmp/ worked like charm.

    0 讨论(0)
  • 2020-12-05 02:26

    No one hasn't mentioned about SELinux. On Centos most probably you will have such error when selinux mode = enforcing.

    Just check getenforce and if it set to 'enforcing' , hit setenforce 0 and try one more time to run service.

    0 讨论(0)
提交回复
热议问题