#!/bin/bash
srchost=111.xx.xx.xx #源地址
srcport=6379 #源端口
srcpass=passwod #密码
srcku=2 #同步的库
desthost=111.x.xx.xx
destport=6666
destpass=xxxxx
destku=13
redis-cli -h $srchost -p $srcport -a $srcpass -n $srcku keys "*" | while read key
do
redis-cli -h $srchost -p $srcport -a $srcpass -n $srcku --raw dump $key | perl -pe 'chomp if eof' | redis-cli -h $desthost -p $destport -a $destpass -n $destku -x restore $key 0
echo "migrate key $key"
done
标签:同步,cli,redis,xx,键值,key,srcku,srcpass From: https://blog.51cto.com/lovejxs/6042709