redis bulk import using --pipe

后端 未结 6 1308
情深已故
情深已故 2020-12-30 11:56

I\'m trying to import one million lines of redis commands, using the --pipe feature.

redis_version:2.8.1

cat file.txt | r

6条回答
  •  南笙
    南笙 (楼主)
    2020-12-30 12:34

    The first point is that the parameters have to be double-quoted. The documentation is somewhat misleading on this point.

    So a working syntax is :

    lpush "name" "joe"
    lpush "name" "bob"
    

    The second point is that each line has to end by an \r\n and not just by \n. To fix that point, you just have to convert your file with the command unix2dos

    like : unix2dos file.txt

    Then you can import your file using cat file.txt | src/redis-cli --pipe

    This worked for me.

提交回复
热议问题