We are using node_redis client to access the redis at present. I need to use HAProxy in front of redis slaves which in my case is 3 nos. I installed the HAProxy and configured it to load balance the redis slaves. But when I tried to create connection from the node_redis client to the HAProxy I was not able to create the connection and was getting a error
Error: Redis reply parser error: Error: Protocol error, got "H" as reply type byte
at HiredisReplyParser.execute (/home/user1/doosra/node-exp/node_modules/redis/lib/parser/hiredis.js:32:31)
at RedisClient.on_data (/home/user1/doosra/node-exp/node_modules/redis/index.js:440:27)
at Socket.<anonymous> (/home/user1/doosra/node-exp/node_modules/redis/index.js:70:14)
at Socket.emit (events.js:67:17)
at TCP.onread (net.js:347:14)
Posting the haproxy configuration would have helped …
The most likely explanation is haproxy is not configured to process generic TCP traffic but HTTP traffic.
Example:
With the following configuration:
and the following node.js script:
… we get the same exact error:
It is expected, because the Redis protocol parser does not understand HTTP.
To fix it, just alter the haproxy configuration to enforce a generic TCP mode:
… and now it works fine.