Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

redis dump.rdb / saving small files

Tags:

redis

People also ask

What is dump RDB in Redis?

By default Redis saves snapshots of the dataset on disk, in a binary file called dump. rdb . You can configure Redis to have it save the dataset every N seconds if there are at least M changes in the dataset, or you can manually call the SAVE or BGSAVE commands.

Where does Redis store dump RDB?

rdb file in the /var/lib/redis/ directory. You'll want to update the permissions so the file is owned by the redis user and group: sudo chown redis:redis /var/lib/redis/dump.

Which is the best way to achieve persistence in Redis?

Within Redis, there are two different ways of persisting data to disk. One is a method called snapshotting that takes the data as it exists at one moment in time and writes it to disk. The other method is called AOF, or append—only file, and it works by copying incoming write commands to disk as they happen.


To be a little more helpfull... How to find or set where redis is saving the dump.rdb file (ubuntu server): First find you redis.conf file: In your terminal run:

ps -e aux | grep redis

I found my redis.conf file in:

var/etc/redis/

If yours is the same place then open the file with:

pico var/etc/redis/redis.conf

Look for:

# 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 /var/lib/redis

Depending on your setting for "dbfilename" and "dir" then that is where you find your redis dump.rdb file.


Update: To see your redis configurations just run:

redis-cli CONFIG GET *

You can set the file location on the redis.conf file (which you start the server with) look at the server configuration for that:

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

finding the location of the currently saved file, it depends on how you start the server - where you have the redis-server file - i think you can find it with ps -e aux | grep redis or ps -e | grep redis


On my (default, Ubuntu) setup the db file is in

/var/lib/redis/redis.rdb

As Christoffer points out, you can see all the settings from the command-line client with

CONFIG GET *

One liner to get both directory and dump file name

echo "CONFIG GET *" | redis-cli | grep -e "dir" -e "dbfilename" -A1

In mac,

the location of dump.rdb is at /usr/local/etc/dump.rdb.
the location of redis.conf is at /usr/local/etc/redis.conf.

In order to find the location use the command find - sudo find / -name "redis.conf"