【发布时间】:2016-11-11 22:42:26
【问题描述】:
redis 的 Ha 代理配置显示如下:
frontend redis
bind *:6379 name port6379
mode tcp
timeout client 15s
#define hosts
acl redis_3 hdr(host) -i im.test.com
#figure out which one to use
use_backend test_redis if redis_3
backend test_redis
mode tcp
timeout connect 4s
timeout server 30s
#balance leastconn
option tcplog
option tcp-check
tcp-check send PING\r\n
tcp-check expect string +PONG
#tcp-check send QUIT\r\n
#tcp-check expect string +OK
server node1_redis 10.146.99.164:6379 check inter 1s
HA 代理日志显示多个连接到 redir。在 redir 服务器上,我看到“对等方重置连接”
在浏览器中,我得到一个“重新初始化的会话”。
但是使用 redis-cli -h ping 我得到了正确的 PONG 响应。将浏览器直接定向到端口 6379 上的 redis 服务器,稍后会给出以下内容:
-ERR wrong number of arguments for 'get' command
-ERR unknown command 'Host:'
-ERR unknown command 'User-Agent:'
-ERR unknown command 'Accept:'
-ERR unknown command 'Accept-Language:'
-ERR unknown command 'Accept-Encoding:'
-ERR unknown command 'Cookie:'
-ERR unknown command 'Connection:'
-ERR unknown command 'Upgrade-Insecure-Requests:'
HAproxy stats 显示后端已启动。
谁能帮我解决这个问题?为什么通过 HA 代理连接时出现错误?
【问题讨论】:
-
在 redis 服务器上使用 redis-cli set hello world 时,当直接使用 curl 连接到 redis 服务器时,我得到了一个连接。但是当我使用 HAproxy 连接时,它会给出错误 (52) Empty reply from server
标签: redis haproxy ubuntu-16.04