Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jserviceorg/b34b4ac52330559da1c9b05b665a0c15 to your computer and use it in GitHub Desktop.
Save jserviceorg/b34b4ac52330559da1c9b05b665a0c15 to your computer and use it in GitHub Desktop.
Save Amazon ElastiCache Redis to file dump.rdb

Instructions to DUMP localy a Elasticache Redis database

Connect to Redis CLI

$ redis-cli

Enable the current redis as a slave for the master node

127.0.0.1:6379> SLAVEOF master-node-address.0001.euw1.cache.amazonaws.com 6379

Issue a sync command, starting sync operations

127.0.0.1:6379> SYNC

Start save the sabe to the dump.rdb file

127.0.0.1:6379> BGSAVE
127.0.0.1:6379> SLAVEOF NO ONE
127.0.0.1:6379> EXIT

Usefull commands

Fetch the number of keys inside the database

127.0.0.1:6379> DBSIZE

Find the location of the configuration file we need this to find out where is Redis data folder

$ redis-cli INFO | grep file
config_file:/usr/local/etc/redis.conf

Location where the .rdb data files are stored

$ cat /usr/local/etc/redis.conf | grep dir --color
dir /usr/local/var/db/redis/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment