Start Redis Server in a directory where Redis has write permissions
The answers above will definitely solve your problem, but here's what's actually going on:
The default location for storing the rdb.dump
file is ./
(denoting current directory). You can verify this in your redis.conf
file. Therefore, the directory from where you start the redis server is where a dump.rdb
file will be created and updated.
It seems you have started running the redis server in a directory where redis does not have the correct permissions to create the dump.rdb
file.
To make matters worse, redis will also probably not allow you to shut down the server either until it is able to create the rdb file to ensure the proper saving of data.
To solve this problem, you must go into the active redis client environment using redis-cli
and update the dir
key and set its value to your project folder or any folder where non-root has permissions to save. Then run BGSAVE
to invoke the creation of the dump.rdb
file.
CONFIG SET dir "/hardcoded/path/to/your/project/folder"
BGSAVE
(Now, if you need to save the dump.rdb file in the directory that you started the server in, then you will need to change permissions for the directory so that redis can write to it. You can search stackoverflow for how to do that).
You should now be able to shut down the redis server. Note that we hardcoded the path. Hardcoding is rarely a good practice and I highly recommend starting the redis server from your project directory and changing the dir key back to
./`.
CONFIG SET dir "./"
BGSAVE
That way when you need redis for another project, the dump file will be created in your current project's directory and not in the hardcoded path's project directory.
redis
, but doesn't help! – wdetac