I'm trying to understand memcached and troubleshoot one of my applications that uses it, but I'm having a hard time executing the set
command. I'm following this tutorial here. https://www.tutorialspoint.com/memcached/memcached_set_data.htm Here is what I'm trying.
nc localhost 11211
set tutorialspoint 0 900 9
memcached
CLIENT_ERROR bad data chunk
I've looked at a couple of other tutorials and I've even looked at the source code of a Golang client and they all seem to be calling set
like this, but for some reason it's not working for me.
I'm on an arm MacBook running memcached version 1.6.19
After looking at some memcached clients and the memcached source code, I found that memcached is looking for the \r\n
line endings and Mac only uses the line feed (LF or \n).
To solve the problem with netcat, I followed this answer here. https://superuser.com/questions/942217/how-do-i-interactively-type-r-n-terminated-query-in-netcat. It says you can use the -C
option but that didn't work for me, and I had to type control-v
+ control-m
instead.