导出
./redis-cli -p 6379 -n 0 keys "*" > rediskey.txt
echo "导出 key 完成"
echo "开始读取 value"
IFS_old=$IFS
IFS=$'\n'
for line in `cat rediskey.txt`
do
value=`./redis-cli -p 6379 -n 0 get $line`
echo $line"++"$value >> value.txt
done
IFS=$IFS_old
echo "完成"
导入
echo "开始读取"
IFS_old=$IFS
IFS=$'\n'
for line in `cat value.txt`
do
OLD_IFS="$IFS"
IFS="++"
arr=($line)
IFS="$OLD_IFS"
key=${arr[0]}
value=${arr[2]}
echo "key: $key"
echo "value: $value"
./redis-cli -h 192.168.110.248 -p 6382 -a feiyuai.com set $key $value
done
IFS=$IFS_old
echo "完成"
网友评论