Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed opening the RDB file ... Read-only file system

Tags:

linux

redis

I'm trying to perform a save or bgsave on my redis instance to run through the backup/restore process. I'm getting errors when I try to save however:

532:M 28 Jun 23:58:30.396 # Failed opening the RDB file backup.rdb (in server root dir /var/lib/redis) for saving: Read-only file system

Permissions on the /var/lib/redis folder:

$@/var/lib$ ls -artl | grep redis
drwxrwxrwx  3 redis    redis    4096 Jun 28 23:58 redis

Permissions on the /var/lib folder:

$@/var$ ls -artl | grep lib
drwxrwxrwx 31 root root  4096 Jun 28 23:44 lib

Permissions on the /var folder:

$@/$ ls -artl | grep var
drwxrwxrwx  11 root root  4096 Jul 18  2016 var

Redis CLI output for config get dir:

1) "dir"
2) "/var/lib/redis"

Redis CLI output for config get dbfilename:

1) "dbfilename"
2) "backup.rdb"

Error from redis:

532:M 28 Jun 23:58:30.396 # Failed opening the RDB file backup.rdb (in server root dir /var/lib/redis) for saving: Read-only file system

Any help would be much appreciated!

like image 265
Ben Avatar asked Jun 29 '17 00:06

Ben


People also ask

Where are RDB files stored?

rdb file can be found under the /data directory in the container. You can also request RDB files on demand by using the SAVE and BGSAVE commands. The SAVE command is synchronous.

Where does Redis store dump RDB?

Using redis-cli SAVE command At this stage, the RDB file will be saved in /var/lib/redis/ and will be named dump. rdb .

What is Redis dump RDB?

By default Redis saves snapshots of the dataset on disk, in a binary file called dump. rdb . You can configure Redis to have it save the dataset every N seconds if there are at least M changes in the dataset, or you can manually call the SAVE or BGSAVE commands.


1 Answers

You need to add the following to your /etc/systemd/system/redis-server unit file:

ReadWriteDirectories=-/var/lib/redis

Note that /var/lib/redis is the default, but if in your /etc/redis/redis.conf you set a different dir config option, you will need to set ReadWriteDirectories to that.

like image 93
almel Avatar answered Oct 18 '22 17:10

almel