Skip to content

Instantly share code, notes, and snippets.

View metamatik's full-sized avatar

Mathieu Richardoz metamatik

  • Paris, France
  • 14:45 (UTC +02:00)
View GitHub Profile
@metamatik
metamatik / migrate-redis.py
Last active March 25, 2020 10:41 — forked from kitwalker12/migrate-redis.py
Migrate Redis data on Amazon ElastiCache
"""
Forked and heavily adappted from:
https://gist.github.com/kitwalker12/517d99c3835975ad4d1718d28a63553e
Copies all keys from the source Redis host to the destination Redis host.
Useful to migrate Redis instances where commands like SLAVEOF and MIGRATE are
restricted (e.g. on Amazon ElastiCache).
The script scans through the keyspace of the given database number and uses
a pipeline of DUMP and RESTORE commands to migrate the keys.