How to use Redis mass insertion?

前端 未结 3 2053
小蘑菇
小蘑菇 2020-12-17 10:53

I\'ve read mass-insert provided at redis.io, but it really confused me. I tried to make a file then use \"cat data.txt | redis-cli --pipe\" to insert:

           


        
3条回答
  •  攒了一身酷
    2020-12-17 11:42

    I was able to work with the SET Key0 Value0 form.

    Please have a look at https://stackoverflow.com/a/30511742/2613942

    The reply is about the LPUSH command. It also works fine with SET.

    To summarize, double-quote the parameters

    SET "mykey" "myval"
    

    Change the format of the file from unix to windows with unix2dos:

    unix2dos myfile.txt
    

    Then import using

    cat myfile.txt | src/redis-cli --pipe

    That worked for me.

提交回复
热议问题