Shell redis pipe 批量写redis
脚本:
cat test-redis-batch.dat | redis-cli -h localhost -p 6379 --pipe
test-redis-batch.dat数据:
set a1 a1
set a2 a2
set a3 a3
执行如果有错误提示:ERR unknown command 'et'
可能原因,redis-cli中只支持doc格式的换行符 \r\n,非该方式换行可以使用unix2dos转换下
unix2dos test-redis-batch.dat
来源:oschina
链接:https://my.oschina.net/yugj/blog/3171623