Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does dump.rdb belong?

Tags:

redis

I remember playing around with some settings and I believe it changed the location of dump.rdb. Now, dump.rdb auto-magically appears at the root of my projects.

Where does it belong, and how would I return it there? Also, how does this location change when in a production environment?

like image 350
Jay Jung Avatar asked Feb 07 '18 09:02

Jay Jung


2 Answers

Where does it belong?

Wherever you want.

The default directory is ./, meaning the directory where the Redis server got started from.

Edit:

* I am modifying your second question (asked in comment) a little bit.

Is it possible to change to location of dump.rdb? How?

Yes, it is possible. There two possible ways I can think of.

1.

Modify redis configuration file (e.g. redis.conf) and restart redis server. This way, every restart after this one will use the new directory. But redis will not reload any previous data at first restart (because there will not be anything to reload from).

  • To reload previous data, previous dump.rdb would have to be moved to new location manually before restarting the server.

2.

Set new directory by CONFIG SET command. E.g.

CONFIG SET dir path/to/new/directory

* Note that the path has to be a directory.

That's it! But this way is not permanent because server restart will use the old directory.

  • To make new directory permanent, execute CONFIG REWRITE to rewrite the configuration file. Remember, redis server has to have write permission to that file.
like image 145
sazzad Avatar answered Sep 20 '22 04:09

sazzad


dir path/to/dorectory has to be set in the redis config file.

like image 28
Akash Avatar answered Sep 17 '22 04:09

Akash