Skip to content

Instantly share code, notes, and snippets.

@itsjwala
Created June 22, 2021 15:25
Show Gist options
  • Save itsjwala/0e26a3c01772fb4c2f6d0d0a032e4f6d to your computer and use it in GitHub Desktop.
Save itsjwala/0e26a3c01772fb4c2f6d0d0a032e4f6d to your computer and use it in GitHub Desktop.
redis cli migrate keys
# use if keys are less, check redis metrics when this is done.
# "migrate" copies keys with TTL
redis-cli -h HOST1 -p 6398 keys \* | xargs -I '{}' -P 100 redis-cli -h HOST1 -p 6398 migrate HOST2 6398 "" 0 5000 COPY KEYS '{}'
# for lots of keys use SCAN to get keys in batches
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment