首先準備數據文件 格式爲redis
SET Key0 Value0
SET Key1 Value1
...
SET KeyN ValueN
利用shell轉換數據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
轉換命令bash
tool.sh input.data > output.data
而後導入到redis中服務器
cat output.data | redis-cli --pipe
若是隻能在win服務器上鍊接內網的redis服務器 可使用app
type outpuf.data | redis-cli.exe -h "127.0.0.1" -p 6379 -a password --pipe