How to start redis with specific .rdb file?
Asked Answered
H

2

7

I had redis installed without password. Then I tried to put password without success and decided to delete all related to redis from my server. After that, I've installed redis once again and set a password successfully. The problem is that now is creating a new database and not reading from the old one. I am running the same command from sabe directory. $~/ redis-server

I've also tried to check if is generating a new dump.rdb file with:

find / -type f -name "*.rdb"

But is only finding my correct dump.rdb file that I'd like to use.

Is there a way to import my last database to this new one? Or, Is there a way to start my server using the correct dump.rdb file?

Hutcherson answered 11/1, 2015 at 14:38 Comment(4)
How did you delete previous data ? Did you FLUSHALL ?Panatella
No, I've opened the file to check and is everything there..Hutcherson
Make sure that your .conf's dir directive is set to the directory where your RDB file is. Furthermore, verify that the filename matches to the value in dbfilename. If these are set correctly and still no luck - what does the log say?Oldcastle
possible duplicate of How do I move a redis database from one server to another?Muro
I
7

The Simplest way to go is

redis-server --dbfilename dump.rdb --dir /home/in_which_directory_rdb_file_exists

Change the .rdb file name and the directory name as per your requirements.

Indulge answered 27/2, 2022 at 6:17 Comment(0)
R
5

Copy your rdb file to correct path:

sudo cp /path/to/rdb/dump.rdb /var/lib/redis/dump.rdb

Make redis owner of new rdb file:

sudo chown redis: /var/lib/redis/dump.rdb

Open redis config file in /etc/redis/redis.conf.

Make sure these two lines are existed and not commented:

dbfilename dump.rdb
dir /var/lib/redis

Turn off other persistence method by changing appendonly option to no (because redis will consider that method first):

appendonly yes

Save and close the config file and restart redis-server:

systemctl restart redis-server

This will work if redis-server is compatible with your rb file.

Responsory answered 10/2, 2018 at 10:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.