首先准備數據文件 格式為
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