Skip to content

Instantly share code, notes, and snippets.

@stephanustedy
Last active April 22, 2020 12:17
Show Gist options
  • Save stephanustedy/eb1d0c0daf5cc83373513b1f6980be52 to your computer and use it in GitHub Desktop.
Save stephanustedy/eb1d0c0daf5cc83373513b1f6980be52 to your computer and use it in GitHub Desktop.
command for copy redis
# COPY REAL TIME / NEW DATA
while true; do exec redis-cli -h [old-endpoint] monitor | sed -u 's/.*]//' | grep -vi "get\|ping" | redis-cli -h [new-endpoint] >> /dev/null; done;
# COPY DATA ON REDIS
redis-cli -h [old-endpoint] --scan | while read key; do echo "Copying $key"; redis-cli -h [old-endpoint] --raw DUMP "$key" | head -c -1 |redis-cli -x -h [new-endpoint] RESTORE "$key" 0; done >> /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment