什么是亚马逊ELB自动健康检查做的,这是什么期待?亚马逊、期待、这是什么、健康

2023-09-12 21:27:07 作者:时光冲淡了我们的回忆

下面是一点:

我们已经实现了一个C ++ REST的API服务器,具有内置的HTTP解析器和像Apache的那种或任何没有标准的HTTP服务器 在它已经被使用了数个月在亚马逊结构,同时使用普通和SSL通信,并没有任何问题已经确定,涉及到亚马逊的基础结构 我们正在部署使用我们的第一个后端亚马逊ELB 在亚马逊ELB有一个可定制健康检查制度,而且作为一个自动一体,正如here 我们已经找到了什么样的数据是由健康检查系统发送的任何文件 在插槽读取指令的后端简单挂起,并最终关闭连接

我不是在寻找的,因为后台不是基于标准的Web服务器上的问题的解决方案,只是如果有人知道什么样的信息被发送的ELB健康检查制度,因为我们没有发现关于此文档的任何地方。

帮助是非常AP preciated。谢谢你。

解决方案   

亚马逊ELB有一个可定制健康检查制度,而且作为一个   自动一体,如上所述here

使用的定制的你是presumably指通过AWS管理控制台中的健康检查配置的(见Configure健康检查设置)或通过API(请参阅ConfigureHealthCheck).

亚马逊Prime Day要来了,备货 预热 引流...你需要知道这些

通过这种方式配置健康检查的要求在现场的目标的的HealthCheck数据类型的文档:

  

指定要检查的实例。该协议可以是TCP,   HTTP,HTTPS,或SSL。有效端口的范围是(1)〜   65535。

     

注意

        

TCP是默认的,指定为TCP:端口对,例如   TCP:5000。在这种情况下,一个简单的状况检查试图打开一个TCP   连接到该实例指定的端口上。 无法连接   配置的超时时间内被认为是不健康的。

  

SSL也被指定为SSL:端口对,例如SSL:5000

  

对于HTTP或HTTPS协议,情况就不同了。您必须   在字符串中包含一个ping路径。的HTTP被指定为一个   HTTP:端口; /; PathToPing;分组,例如   HTTP:80 /天气/美国/ WA /西雅图。在这种情况下,HTTP GET请求是   发出实例的给定端口和路径上。 任何回答其他   不是200 OK的超时时间内被认为是不健康的。

  

在HTTP平目标的总长度需要是1024个16位   统一code字符以内。

        

[重点煤矿] 的

使用的自动的你是presumably指在Why是从API和控制台显示的URL不同的健康检查网址:

  

除了健康检查,你配置负载平衡器,   第二次健康检查,执行按以防止服务   被终止引起的实例潜在副作用而不   被注销。要执行此检查,负载均衡器打开   该健康检查被配置为在同一端口上的TCP连接   使用,然后关闭连接后的健康检查   完成。 [重点煤矿] 的

段落的解决方法的明确有效载荷为零这里,也就是说,它是类似于上面的配置的健康检查中所述的非HTTP / HTTPS方式:

  

这额外的健康检查不影响性能的   应用,因为它不发送任何数据到后端   实例。您不能禁用或关闭此健康检查。

概要/解决方案

假设你的的RESTful API服务器,具有内置的HTTP分析器的应该是服务于HTTP仅的确,你需要处理两个健康检查:

您配置的第一个自己的作为HTTP:端口; /; PathToPing 的 - 您会收到 HTTP GET 要求和必须回答与 200 OK 在指定的超时期限内被认为是健康的。 第二个由服务自动配置 - 这将打开上方配置的HTTP端口的TCP连接,也不会发送任何数据,然后关闭健康检查结束后连接

总之,似乎你的服务器可能会表现完美的罚款已经和你的第二个健康检查的行为只是有点烦 - ?不ELB实际上考虑你的服务器是不健康的。

Here is the thing:

We've implemented a C++ RESTful API Server, with built-in HTTP parser and no standard HTTP server like apache or anything of the kind It has been in use for several months in Amazon structure, using both plain and SSL communications, and no problems have been identified, related to Amazon infra-structure We are deploying our first backend using Amazon ELB Amazon ELB has a customizable health check system but also as an automatic one, as stated here We've found no documentation of what data is sent by the health check system The backend simple hangs on the socket read instruction and, eventually, the connection is closed

I'm not looking for a solution for the problem since the backend is not based on a standard web server, just if someone knows what kind of message is being sent by the ELB health check system, since we've found no documentation about this, anywhere.

Help is much appreciated. Thank you.

解决方案

Amazon ELB has a customizable health check system but also as an automatic one, as stated here

With customizable you are presumably referring to the health check configurable via the AWS Management Console (see Configure Health Check Settings) or via the API (see ConfigureHealthCheck).

The requirements to pass health checks configured this way are outlined in field Target of the HealthCheck data type documentation:

Specifies the instance being checked. The protocol is either TCP, HTTP, HTTPS, or SSL. The range of valid ports is one (1) through 65535.

Note

TCP is the default, specified as a TCP: port pair, for example "TCP:5000". In this case a healthcheck simply attempts to open a TCP connection to the instance on the specified port. Failure to connect within the configured timeout is considered unhealthy.

SSL is also specified as SSL: port pair, for example, SSL:5000.

For HTTP or HTTPS protocol, the situation is different. You have to include a ping path in the string. HTTP is specified as a HTTP:port;/;PathToPing; grouping, for example "HTTP:80/weather/us/wa/seattle". In this case, a HTTP GET request is issued to the instance on the given port and path. Any answer other than "200 OK" within the timeout period is considered unhealthy.

The total length of the HTTP ping target needs to be 1024 16-bit Unicode characters or less.

[emphasis mine]

With automatic you are presumably referring to the health check described in paragraph Cause within Why is the health check URL different from the URL displayed in API and Console?:

In addition to the health check you configure for your load balancer, a second health check is performed by the service to protect against potential side-effects caused by instances being terminated without being deregistered. To perform this check, the load balancer opens a TCP connection on the same port that the health check is configured to use, and then closes the connection after the health check is completed. [emphasis mine]

The paragraph Solution clarifies the payload being zero here, i.e. it is similar to the non HTTP/HTTPS method described for the configurable health check above:

This extra health check does not affect the performance of your application because it is not sending any data to your back-end instances. You cannot disable or turn off this health check.

Summary / Solution

Assuming your RESTful API Server, with built-in HTTP parser is supposed to serve HTTP only indeed, you will need to handle two health checks:

The first one you configured yourself as a HTTP:port;/;PathToPing - you'll receive a HTTP GET request and must answer with 200 OK within the specified timeout period to be considered healthy. The second one configured automatically by the service - it will open a TCP connection on the HTTP port configured above, won't send any data, and then closes the connection after the health check is completed.

In conclusion it seems that your server might be behaving perfectly fine already and you are just irritated by the 2nd health check's behavior - does ELB actually consider your server to be unhealthy?