6

I get this in my Redis logs:

1182:M 30 Nov 14:27:00.028 * 1 changes in 900 seconds. Saving...
1182:M 30 Nov 14:27:00.029 * Background saving started by pid 1920
1920:C 30 Nov 14:27:00.029 # Failed opening .rdb for saving: Read-only file system
1182:M 30 Nov 14:27:00.130 # Background saving error

Redis is configured to use this directory:

ubuntu@XXXXX:~$ redis-cli
127.0.0.1:6379> config get dir
1) "dir"
2) "/mnt/persistent/redis-data"

If I become the redis user I can write to that directory fine:

ubuntu@XXXXX:~$ sudo su - redis
redis@XXXXX:~$ touch /mnt/persistent/redis-data/caniwrite
redis@XXXXX:~$ ls /mnt/persistent/redis-data/caniwrite
/mnt/persistent/redis-data/caniwrite

It appears to be mounted as read-write:

root@XXXXX:~# mount -l | grep /mnt/persistent
/dev/xvdh on /mnt/persistent type ext4 (rw,relatime,data=ordered)

This is a mounted AWS Elastic Block Store. I'm running Ubuntu.

Any ideas why Redis server would report it can't write, but the redis user can?

1 Answer 1

9

I found the answer, and it confims that this one is sufficiently different to other similar questions!

I'm not yet why, but my service file had been rolled back to the default. The /etc/systemd/system/redis.service should have contained (and previously did):

[Service]
ReadWriteDirectories=-/mnt/persistent/redis-data
1
  • 2
    If your systemd unit configuration is managed independently from your customization (package manager, other team members), you can make use of a drop in directory on any unit. In this case /etc/systemd/system/redis.service.d/custom.conf Nov 30, 2018 at 19:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .