我有一个网络负载均衡器和一个关联的目标组,配置为对EC2实例进行运行状况检查.问题是我看到了很多健康检查请求; 每秒多次.
检查之间的默认间隔应该是30秒,但是它们比它们应该的频率高出约100倍.
我的堆栈是在CloudFormation中构建的,我试过覆盖HealthCheckIntervalSeconds
,这没有任何效果.有趣的是,当我尝试在控制台中手动更改间隔时,我发现这些值是灰色的:
这是模板的相关部分,我尝试更改注释的间隔:
NLB: Type: "AWS::ElasticLoadBalancingV2::LoadBalancer" Properties: Type: network Name: api-load-balancer Scheme: internal Subnets: - Fn::ImportValue: PrivateSubnetA - Fn::ImportValue: PrivateSubnetB - Fn::ImportValue: PrivateSubnetC NLBListener: Type : AWS::ElasticLoadBalancingV2::Listener Properties: DefaultActions: - Type: forward TargetGroupArn: !Ref NLBTargetGroup LoadBalancerArn: !Ref NLB Port: 80 Protocol: TCP NLBTargetGroup: Type: AWS::ElasticLoadBalancingV2::TargetGroup Properties: # HealthCheckIntervalSeconds: 30 HealthCheckPath: /healthcheck HealthCheckProtocol: HTTP # HealthyThresholdCount: 2 # UnhealthyThresholdCount: 5 # Matcher: # HttpCode: 200-399 Name: api-nlb-http-target-group Port: 80 Protocol: TCP VpcId: !ImportValue PublicVPC
我的EC2实例位于私有子网中,无法访问外部世界.NLB是内部的,因此没有通过API网关就无法访问它们.API网关没有/healthcheck
配置端点,因此可以排除来自AWS网络外部的任何活动,例如手动ping端点的人员.
这是我从CloudWatch获取的应用程序日志的示例,而应用程序应该处于空闲状态:
07:45:33 {"label":"Received request URL","value":"/healthcheck","type":"trace"} 07:45:33 {"label":"Received request URL","value":"/healthcheck","type":"trace"} 07:45:33 {"label":"Received request URL","value":"/healthcheck","type":"trace"} 07:45:33 {"label":"Received request URL","value":"/healthcheck","type":"trace"} 07:45:34 {"label":"Received request URL","value":"/healthcheck","type":"trace"} 07:45:34 {"label":"Received request URL","value":"/healthcheck","type":"trace"} 07:45:34 {"label":"Received request URL","value":"/healthcheck","type":"trace"} 07:45:35 {"label":"Received request URL","value":"/healthcheck","type":"trace"} 07:45:35 {"label":"Received request URL","value":"/healthcheck","type":"trace"} 07:45:35 {"label":"Received request URL","value":"/healthcheck","type":"trace"}
我通常每秒收到3到6个请求,所以我想知道这是否只是网络负载均衡器的工作方式,而且AWS仍然没有记录(或者我没有找到它),或者其他如何我可以解决这个问题.
更新:这已在相关的aws论坛帖子上得到解答,该帖子确认它是网络负载均衡器的正常行为,并引用其分布式性质作为原因.无法配置自定义间隔.此时,文档仍然过时,另有说明.
这可能是NLB目标组中的错误,也可能是文档不正确的正常行为.我得出这个结论是因为:
我确认健康检查来自NLB
配置选项在控制台上显示为灰色
推断AWS了解或强加了此限制
其他人也观察到了同样的结果
该文档专门用于网络负载均衡器
AWS文档通常会引导您进行疯狂的追逐
在这种情况下,我认为可能是正常行为被错误地记录,但是没有办法验证除非来自AWS的人可以,并且几乎不可能在aws论坛上得到这样的问题的答案.
能够配置设置或者至少更新文档会很有用.