如何通过netcat/telnet运行memcached的set命令

huangapple go评论41阅读模式
英文:

How do run set command with memcached via netcat/telnet

问题

我尝试理解memcached并排除使用它的应用程序中的问题,但我很难执行set命令。我正在按照这个教程操作:https://www.tutorialspoint.com/memcached/memcached_set_data.htm 这是我的尝试。

nc localhost 11211
set tutorialspoint 0 900 9
memcached

CLIENT_ERROR bad data chunk

我已经查看了几个其他教程,甚至查看了一个Golang客户端的源代码,它们似乎都像这样调用set,但由于某种原因,它对我不起作用。

我在运行memcached版本1.6.19的arm MacBook上。

英文:

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

答案1

得分: 0

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.

英文:

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.

huangapple
  • 本文由 发表于 2023年3月23日 11:33:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/75819040.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定