Skip to content

Instantly share code, notes, and snippets.

@tsonglew
Created December 23, 2019 07:42
Show Gist options
  • Save tsonglew/8c32d0cb79599cd4499eedd87c5d1b0a to your computer and use it in GitHub Desktop.
Save tsonglew/8c32d0cb79599cd4499eedd87c5d1b0a to your computer and use it in GitHub Desktop.
copy key from a redis to another
#set connection data accordingly
source_host=*.*.*.*
source_port=6379
target_host=*.*.*.*
target_port=6379
passwd=redisPasswd
key=testKey
redis-cli --raw -h $source_host -p $source_port -a $passwd DUMP "$key" | head -c -1 | redis-cli -x -h $target_host -p $target_port -a $passwd RESTORE "$key" 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment