I'm trying to follow Redis Mass Insertion – Redis with Redis and something is amiss(.
root@f7ca5eef4a4c:~# redis-cli --version
redis-cli 3.0.6
root@f7ca5eef4a4c:~# redis-cli
127.0.0.1:6379> flushall
OK
127.0.0.1:6379>
root@f7ca5eef4a4c:~# for i in {0..10} ; do echo "SET Key$i Value$i" >> $$ ; done
root@f7ca5eef4a4c:~# cat $$ | redis-cli --pipe
All data transferred. Waiting for the last reply...
ERR unknown command 'ET'
ERR unknown command 'ET'
ERR unknown command 'ET'
ERR unknown command 'ET'
ERR unknown command 'ET'
ERR unknown command 'ET'
ERR unknown command 'ET'
ERR unknown command 'ET'
ERR unknown command 'ET'
ERR unknown command 'ET'
Last reply received from server.
errors: 10, replies: 11
root@f7ca5eef4a4c:~# cat $$
SET Key0 Value0
SET Key1 Value1
SET Key2 Value2
SET Key3 Value3
SET Key4 Value4
SET Key5 Value5
SET Key6 Value6
SET Key7 Value7
SET Key8 Value8
SET Key9 Value9
SET Key10 Value10
root@f7ca5eef4a4c:~#
What am I doing wrong? Why is it failing?
asked Jan 29, 2016 at 19:46
alexus
7,46514 gold badges46 silver badges71 bronze badges
1 Answer 1
I think redis is expecting lines terminated by \r or \r\n. If you're doing this on linux, you'll get \n terminated lines, which redis can't parse.
Try this, in the same directory where you entered the other commands:
# rm $$
# for i in {0..10} ; do printf "SET Key$i Value$i\r\n" >> $$ ; done
# cat $$ | redis-cli --pipe
Whoever wrote that tutorial was probably working on Mac or Windows, which happened to produce the appropriate line terminators.
answered Jan 29, 2016 at 20:22
panta82
2,7213 gold badges22 silver badges38 bronze badges
Sign up to request clarification or add additional context in comments.