阅读背景:

AWS:没有一个实例正在发送数据

来源:互联网 

I'm trying to set up an Elastic Beanstalk application with Amazon Web Services however I'm receiving a load of errors with the message None of the instances are sending data. I've tried deleting the Elastic Beanstalk Application and the EC2 instance several times with the sample application and trying again but I get the same error.

我正在尝试用Amazon Web Services建立一个弹性Beanstalk应用程序,但是我收到了一大堆错误信息,其中没有一个实例正在发送数据。我尝试过多次删除示例应用程序的弹性Beanstalk应用程序和EC2实例,并再次尝试,但得到了相同的错误。

I also tried uploading a flask application with AWS Elastic Beanstalk command line tools but then I received the error below:

我也尝试过用AWS弹性Beanstalk命令行工具上传flask应用程序,但是我收到了以下错误:

Environment health has transitioned from Pending to Severe. 100.0 % of the requests to the ELB are failing with HTTP 5xx. Insufficient request rate (0.5 requests/min) to determine application health (7 minutes ago). ELB health is failing or not available for all instances. None of the instances are sending data

Why do I get this error and how do I fix it? Thanks.

我为什么会得到这个错误,我该怎么修正呢?谢谢。

3 个解决方案

#1


30  

You are using Enhanced Health Monitoring. With enhanced health monitoring an agent installed on your EC2 instance monitors vital system and application level health metrics and sends them directly to Elastic Beanstalk.

您正在使用增强的健康监控。通过增强的健康监视,安装在EC2实例上的代理可以监视重要的系统和应用程序级别的健康度量,并将它们直接发送到弹性Beanstalk。

When you see an error message like "None of the instances are sending data", it means either the agent on the instance has crashed or it is unable to post data to Elastic Beanstalk due to networking error or some other error.

当您看到像“没有一个实例正在发送数据”这样的错误消息时,这意味着实例上的代理已经崩溃,或者由于网络错误或其他错误而无法将数据发送到Elastic Beanstalk。

For debugging this, I would recommend downloading "Full logs" from the AWS console. You can follow the instructions for getting logs in the section "Downloading Bundle Logs from Elastic Beanstalk Console" here. If you are unable to download logs using the console for any reason you can also ssh to the instance and look at the logs in /var/log.

对于调试,我建议从AWS控制台下载“完整日志”。您可以按照“从弹性Beanstalk控制台下载Bundle日志”一节中的说明获取日志。如果由于任何原因无法使用控制台下载日志,您还可以ssh到实例并查看/var/ login中的日志。

You will find logs for the health agent in /var/log/healthd/daemon.log. Additional logs useful for this situation are /var/log/cfn-init.log, /var/log/eb-cfn-init.log and /var/log/eb-activity.log. Can you look at the logs and give more details of the errors you see? This should hopefully give you more details regarding the error "None of the instances are sending data".

您将在/var/log/healthd/daemon.log中找到健康代理的日志。对于这种情况有用的其他日志是/var/log/cfn- init。日志,/var/log/eb-cfn-init。日志和/var/log/eb-activity.log。你能看一下日志并给出你看到的错误的更多细节吗?这应该会给您更多关于“没有一个实例正在发送数据”错误的细节。

Regarding other health "causes" you are seeing:

关于你所看到的其他健康“原因”:

  • Environment health has transitioned from Pending to Severe - This is because initially your environment health status is Pending. If the instances do not go healthy within grace period health status transitions to Severe. In your case since none of the instances is healthy / sending data, the health transitioned to Severe.

    环境健康已经从等待状态过渡到严重状态——这是因为最初您的环境健康状态是等待状态。如果情况在宽限期内不健康,健康状况将转变为严重。在您的例子中,由于没有一个实例是健康的/发送的数据,因此健康状态变为严重的。

  • 100.0 % of the requests to the ELB are failing with HTTP 5xx. Insufficient request rate (0.5 requests/min) to determine application health (7 minutes ago). Elastic Beanstalk monitors other resources in addition to your EC2 instances when using enhanced health monitoring. For example, it monitors cloudwatch metrics for your ELB. This error means that all requests sent to your environment CNAME/load balancer are failing with HTTP 5xx errors. At the same time the request rate is very low only 0.5 requests per minute, so this indicates that even though all requests are failing, the request rate is pretty low. "7 minutes ago" means that information about ELB metrics is slightly old. Because Elastic Beanstalk monitors cloudwatch metrics every few minutes, so the data can be slightly stale. This is as opposed to health data we get directly from the EC2 instances which is "near real time". In your case since the instances are not sending data the only available source for health is ELB metrics which is delayed by about 7 minutes.

    对ELB的请求的100.0%在HTTP 5xx中失败。请求率(0.5个请求/分钟)不足,无法确定应用程序的健康状况(7分钟前)。弹性Beanstalk在使用增强的健康监视时,将监视除EC2实例之外的其他资源。例如,它为您的ELB监视cloudwatch度量。这个错误意味着发送给您的环境CNAME/load均衡器的所有请求都在HTTP 5xx错误中失败。与此同时,请求率非常低,每分钟只有0.5个请求,因此这表明即使所有请求都失败了,请求率也非常低。“7分钟前”意味着有关ELB度量的信息有些陈旧。因为弹性Beanstalk每隔几分钟监视cloudwatch度量,所以数据可能有点陈旧。这与我们直接从EC2实例获得的健康数据相反,这些实例“接近实时”。在您的示例中,由于实例没有发送数据,因此惟一可用的健康源是ELB度量,延迟了大约7分钟。

  • ELB health is failing or not available for all instances Elastic Beanstalk is looking at the health of your ELB, i.e. it is checking how many instances are in service behind ELB. In your case either all instances behind ELB are out of service or the health is not available for some other reason. You should double check that your service role is correctly configured. You can read how to configure service role correctly here or in the documentation. It is possible that your application failed to start.

    弹性Beanstalk正在检查您的ELB的健康状况,也就是说,它将检查在ELB后面有多少实例在使用。在您的案例中,要么ELB后面的所有实例都已停止服务,要么由于其他原因健康状态不可用。您应该再次检查您的服务角色是否正确配置。您可以在这里或文档中阅读如何正确配置服务角色。您的应用程序可能无法启动。

In your case I would suggest focusing on the first error "None of the instances are sending data". For this you need to look at the logs as outlined above. Let me know what you see in the logs. The agent is started fairly early in the bootstrap process on the instance. So if you see an error like "None of the instances are sending data", it is very likely that bootstrap failed or the agent failed to start for some reason. The logs should tell you more.

在您的例子中,我建议关注第一个错误“没有一个实例正在发送数据”。为此,您需要查看上面列出的日志。让我知道你在日志里看到了什么。代理在实例的引导过程中很早就开始了。因此,如果您看到“没有任何实例正在发送数据”之类的错误,很可能引导失败或代理由于某种原因启动失败。日志应该告诉你更多。

Also make sure you are using an instance profile with your environment. Instance profile allows the health agent running on your EC2 instance to authenticate with Elastic Beanstalk. If instance profile is not associated with your environment then the agent will not be able to send data to Elastic Beanstalk. Read more about Instance Profiles with Elastic Beanstalk here.

还要确保在环境中使用实例概要文件。实例概要文件允许运行在EC2实例上的健康代理使用弹性Beanstalk进行身份验证。如果实例概要文件与您的环境没有关联,那么代理将无法将数据发送到弹性Beanstalk。在这里阅读更多关于弹性豆茎的实例概要。

Update One common reason for the health cause "None of the instances are sending data" can be that your instance is in a VPC and your VPC does not allow NTP access. Typical indicator of this problem is the following message in /var/log/messages: ntpdate: Synchronizing with time server: [FAILED]. When this happens the clock on your EC2 instance can get out of sync and the data is considered invalid. You should also see a health cause on the instances on the health page on the AWS web console that tells you that instance clock is out-of-sync. The fix is to make sure that your VPC allows access to NTP.

更新健康原因“没有任何实例正在发送数据”的一个常见原因可能是您的实例在VPC中,并且您的VPC不允许NTP访问。此问题的典型指示符是/var/log/message: ntpdate:与time server同步:[FAILED]。当这种情况发生时,EC2实例上的时钟可能会不同步,数据被认为是无效的。您还应该在AWS web控制台的health页面上的实例上看到健康原因,该页面告诉您实例时钟不同步。解决方法是确保您的VPC允许访问NTP。


#2


4  

There can be many reasons why the health agent is not able to send any data, so this may not be the answer to your problem, but it was to mine and hopefully can help somebody else:

可能有很多原因导致卫生代理不能发送任何数据,所以这可能不是你问题的答案,但这是我的,希望能帮助其他人:

I got the same error and looking into /var/log/healthd/daemon.log the following was repeatedly reported:

我得到了相同的错误,并查看了/var/log/ healthd/daemon.com。日志中多次报告:

sending message(s) failed: (Aws::Healthd::Errors::GroupNotFoundException) Group 97c30ca2-5eb5-40af-8f9a-eb3074622172 does not exist

This was caused by me making and using an AMI image from an EC2 instance inside an Elastic Beanstalk environment. That is, I created a temporary environment with one instance the same configuration as my production environment, went into the EC2 console and created an image of the instance, terminated the temporary environment, and then created yet another environment using the new custom AMI.

这是我在一个弹性Beanstalk环境中创建并使用来自EC2实例的AMI映像造成的。也就是说,我创建了一个临时环境,其中一个实例的配置与我的生产环境相同,然后进入EC2控制台并创建实例的映像,终止临时环境,然后使用新的自定义AMI创建另一个环境。

Of course (in hindsight) this meant some settings of the temporary environment were still being used. In this case specifically /etc/healthd/config.yaml, resulting in the health agent trying to send messages to a no longer existing health group.

当然(事后看来)这意味着临时环境的一些设置仍然在使用。在这种情况下,特别是/etc/ healthd/config。yaml,导致健康代理试图向不再存在的健康组发送消息。

To fix this and make sure there was no other stale configuration around, I instead started a new EC2 instance by hand from the default AMI used in the production environment (find it under the 'Instances' configuration page of your environment), provision that, then create a new image from that and use that image in my new EB environment.

为了解决这个问题,确保周围没有其他的配置,我反而开始一个新的EC2实例用手在生产环境中使用的默认AMI(找到它在您的环境的“实例”配置页面),条款,然后创建一个新的形象,并使用这一形象在我新的EB环境。

#3


1  

I solved this by adding another security group (the default one for my Elastic Beanstalk).

我通过添加另一个安全组(弹性豆茎的默认组)来解决这个问题。


分享到: