首先准备数据文件 格式为
SET Key0 Value0 SET Key1 Value1 ... SET KeyN ValueN
利用shell转换数据
#!/bin/bash while read CMD; do # each command begins with *{number arguments in command}\r\n XS=($CMD); printf "*${#XS[@]}\r\n" # for each argument, we append ${length}\r\n{argument}\r\n for X in $CMD; do printf "\$${#X}\r\n$X\r\n"; done done
转换命令
tool.sh input.data > output.data
然后导入到redis中
cat output.data | redis-cli --pipe
如果只能在win服务器上连接内网的redis服务器 可以使用
type outpuf.data | redis-cli.exe -h "127.0.0.1" -p 6379 -a password --pipe
时间: 2024-12-10 11:01:08