I installed the redis-cli using “brew install redis” but after connecting using the command “redis-cli -p 6379”, I get 127.0.0.1:6379> and then enter PING. For any command I try to enter like PING, I get the error “Error: Protocol error, got “\x00” as reply type byte”. I’ve been getting around this by using “echo -en ‘*1\r\n$4\r\nPING\r\n’ | nc localhost 6379” which is working fine, but I’m trying to get the redis-cli to work for the Set and Get Commands Stage so I can more easily enter many commands. Has anyone else ran into this issue and got it to work?
I wonder if your instance is configured to speak SSL by default. Can you look at /opt/homebrew/etc/redis.conf
and see if tls-port
is set?
It doesn’t look like I have that specific path. But I have /usr/local/etc/redis.conf instead and when I checked here tls-port wasn’t set.
Hey @NIHARSIMHADRI, could you check whether your implementation continues to process commands (on the same connection) after receiving an unknown one?
When redis-cli starts up, it sends a COMMAND DOCS
, which your implementation does not support (and that’s totally fine).
However, when I sent a PING immediately afterward, the connection was closed instead of continuing to process the PING.
Let me know if you’d like help investigating further.
Thanks Andy, this helped me fix the issue. For some reason, after the line send(i, “-ERR unknown command\r\n”, 24, 0); executed, the next command would show the error above. I just made COMMAND DOCS a supported command and now things are working. Is the “ERR unknown command” message breaking things because a RESP response can’t start with a dash (-)? Also, just out of curiosity, how did you do this analysis? Is it Wireshark?
@NIHARSIMHADRI Glad to hear you got it working!
Is the “ERR unknown command” message breaking things because a RESP response can’t start with a dash (-)?
RESP error responses do start with a dash, so that’s totally valid.
Looks like it’s redis-cli that initiated the FIN, possibly because it didn’t expect an error for COMMAND DOC.
A PING (or whatever command) was never sent out:
Also, just out of curiosity, how did you do this analysis? Is it Wireshark?
Yep, I used Wireshark with the filter tcp.port == 6379
.