9

I have a dump.rdb file, which is in the same directory as redis.config.

When I start my sever:

redis-server ./redis.config

It does not load the data in that 1 GB file.

How do I load that data?

Alex
  • 8,471
  • 26
  • 75
  • 99

3 Answers3

9

Edit your config file to set the dir option to the current working directory:

# The filename where to dump the DB
dbfilename dump.rdb

# The working directory.
#
# The DB will be written inside this directory, with the filename specified
# above using the 'dbfilename' configuration directive.
# 
# Also the Append Only File will be created inside this directory.
# 
# Note that you must specify a directory here, not a file name.
dir /current/working/directory
quanta
  • 51,413
  • 19
  • 159
  • 217
  • It's important to also turn off Append Only mode: `appendonly no` - otherwise nothing happens. (as per other answers here) – TheStoryCoder Sep 17 '20 at 18:16
  • See also duplicate: https://stackoverflow.com/questions/14497234/how-to-recover-redis-data-from-snapshotrdb-file-copied-from-another-machine – TheStoryCoder Sep 17 '20 at 18:24
2

Do as follow:

  1. modify the redis.conf, disable the appendonly.aof
    appendonly no
  1. Restart the redis-server

  2. Run redis-cli BGREWRITEAOF, to create a new appendonly file.

  3. Modify redis config appendonly to yes and restart your redis-server

Please see this

Jenny D
  • 27,780
  • 21
  • 75
  • 114
cherish
  • 121
  • 1
1

We found we had to switch aof off beforehand otherwise redis creates a blank aof at boot and uses that instead of the rdb file. Once redis creates a populated aof then you can switch aof back on.

andrew pate
  • 271
  • 1
  • 2
  • 6