[alibaba/tengine]upstream 带上check参数后直接502

2023-12-21 796 views
7

操作系统版本:CentOS7.8 服务器A:10.1.1.4(主) 服务器B:10.1.1.5 (从) 对外VIP地址:10.1.1.3 部署的Tengine-2.3.2版本,服务器两台安装了keepalived,两台服务器使用VIP地址10.1.1.3对外提供服务, 其中有个 upstream 的设置
upstream bpm_server{ server 10.1.2.8:8080; check interval=3000 rise=2 fall=3 timeout=1000 type=http; check_http_send "HEAD / HTTP/1.0\r\n\r\n"; check_http_expect_alive http_2xx http_3xx; 然后tengine就返回502错误了,如果去掉check就正常了 upstream bpm_server{ server 10.1.2.8:8080; 但是在10.1.1.5 增加check 仍然是正常的, 想问下Tengine的check检查服务和keepalive有什么关系吗?

参考的:https://tengine.taobao.org/document_cn/http_upstream_check_cn.html

回答

3

说明你配置的check内容,10.1.2.8:8080返回的不是2xx或者3xx?

2
10.1.2.8:8080返回的302跳转,是正常的业务逻辑跳转 访问10.1.2.8:8080的时候会302跳转到10.1.2.8:8080/Portal/index.html

但是域名指向到10.1.1.5 就正常,可以检查的,10.1.1.4和10.1.1.5的tengine是相同的配置 唯一不同的就是VIP地址在10.1.1.4上

7

在另外的测试环境中,使用相同的tengine配置,也可以正常使用·

2

*11457196 no live upstreams while connecting to upstream, client: 222.247.212.57, server: bpm-task.hongsin.cn, request: "GET /Portal/

报的错类似于这种· 页面会显示502 Bad Gateway 去掉 check interval=3000 rise=2 fall=3 timeout=1000 type=http; check_http_send "HEAD / HTTP/1.0\r\n\r\n"; check_http_expect_alive http_2xx http_3xx reload后马上正常·

8

这个就是 你 check_http_send 配置的内容不满足业务需求,导致你10.1.2.8:8080返回的不是2xx或者3xx。 你说的回复302,是你业务访问回复302,业务发起的请求内容和你 tengine配置的check_http_send中又不是一样的。

执行 telnet 10.1.2.8 8080,然后输入 HEAD / HTTP/1.0,然后按2次回车,看看响应是什么

1

输入HEAD / HTTP/1.0返回的是这个HTTP/1.1 403 Forbidden 然后telnet就断开了, 10.1.2.8 服务器是windows2012 上面部署的是IIS7.5 是不是要增加下http_4xx ? check_http_expect_alive http_2xx http_3xx http_4xx


[root@HD-Nginx-A conf]# telnet 10.1.2.8 8080 Trying 10.1.2.8... Connected to 10.1.2.8. Escape character is '^]'.

HEAD / HTTP/1.0\r\n\r\n HTTP/1.1 403 Forbidden Content-Length: 1157 Content-Type: text/html Server: Microsoft-IIS/8.5 X-Powered-By: ASP.NET Date: Thu, 23 Jul 2020 07:05:05 GMT Connection: close

Connection closed by foreign host.

6

请你解决了吗?我遇到跟你一模一样的问题。

7

@random-heap 没有,加上 check_http_expect_alive http_2xx http_3xx http_4xx 加上http_4xx仍然会出现这个问题· 但是keepalived从机器上就又正常·