Talking to redis through netcat

2,733 views
Skip to first unread message

marc perkel

unread,
Jul 12, 2016, 11:30:28 PM7/12/16
to Redis DB
Doing some command line stuff and trying to avoid user redis-cli because of load issues. But trying to understand the strange results.

I have a set called yy that contans 3 elements a b c

if I run 

echo smembers yy | redis-cli --raw

I get
a
b
c

But if I run: 

echo smembers yy | sed -e 's/$'"/`echo \\\r`/" | nc localhost 6379

I get

*3
$1
a
$1
b
$1
c

Trying to figure out what the extra stuff is and how to get rid of it.

Thanks in advance.

Also - why the need for CRLF and not just newline?

Itamar Haber

unread,
Jul 13, 2016, 4:54:46 AM7/13/16
to Redis DB

Hello Marc,

The extra stuff and CRLF are all part of RESP, the protocol that Redis uses. You can read more about it at http://redis.io/topics/protocol. To get rid of it, uninstall Redis ;)

Itamar

--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at https://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/d/optout.

marc perkel

unread,
Jul 13, 2016, 4:37:50 PM7/13/16
to Redis DB
Thanks for the link, That was useful.
Reply all
Reply to author
Forward
0 new messages