当我在端口6379上的redis服务器中,我应该能够使用http://redis.io/topics/protocol中概述的协议规范。相反,我的体积长度无效。我在初始 *3(启动协议规格)之后放置的任何内容都会返回此错误。我正在使用Suse Linux Enterprise11。
上使用Bash例如:
telnet localhost 6379
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
*3rn$5rnLPUSHrn$4rnlogsrn$20rn"this is some data!"rn
-ERR Protocol error: invalid multibulk length
Connection closed by foreign host.
甚至:
telnet localhost 6379
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
*3rn
-ERR Protocol error: invalid multibulk length
Connection closed by foreign host.
我在Redis 2.6(Redis Server v = 2.6.13)上,应支持协议规格。我会做错什么?提前致谢,科尔
r n未通过telnet解释。它们代表运输返回和线额,只是Telnet协议的一部分。只需按" Enter"即可从telnet生成它们。
$ telnet 127.0.0.1 6379
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
*3
$5
LPUSH
$4
logs
$20
"this is some data!"
:1
quit
+OK
我建议使用任何perl/python/ruby/php/...脚本访问redis,而不必直接从shell脚本处理redis协议。