Why does Elastic Load Balancing report 'Out of

2019-03-11 14:20发布

I am trying to set up Elastic Load Balancing (ELB) in AWS to split the requests between multiple instances. I have created several images of my webserver based on the same AMI, and I am able to ssh into each individually and access the site via each distinct public DNS.

I have added each of my instances to the load balancer, but they all come back with the Status: Out of Service because they failed the health check. I'm mostly confused because I can access each instance from its public DNS, but I get a timeout whenever I visit the load balancer DNS name.

I've been trying to read through all the docs and googling it, but I'm stuck. Any pointers or links in the right direction would be greatly appreciated.

11条回答
等我变得足够好
2楼-- · 2019-03-11 14:58

I had a similar issue. The problem appears to have been caused due to my using a HTTP health check and also using .htaccess to password protect the site.

查看更多
一夜七次
3楼-- · 2019-03-11 14:59

I would like to provide you a general way to solve this problem. When you have set up you web server like apache or nginx, try to read the access log file to see what happened. In my occasion, it report 401 error because I have add the basic auth in nginx. Of course, just like @ivankoni remind, it may because of the document you check is not exist.

查看更多
Explosion°爆炸
4楼-- · 2019-03-11 15:06

I to faced same issue , i changed Ping Protocol from https to ssl .. it worked !

Go to Health Check  --> click on Edit Health Check -- > change Ping protocol from HTTPS to SSL
Ping Target SSL:443
Timeout 5 seconds
Interval    30 seconds
Unhealthy Threshold 5
Healthy Threshold   10
查看更多
走好不送
5楼-- · 2019-03-11 15:07

Health check is (by default) made by accessing index.html on each instance incorporated in load balancer. If you don't have index.html in document root of instance - default health check will fail. You can set custom protocol, port and path for health check when creating elastic load balancer.

查看更多
不美不萌又怎样
6楼-- · 2019-03-11 15:10

Finally I got this working. The issue was with the Amazon Security Groups, because I've restricted the access to port 80 to few machines on my development area and the load balancer could not access the apache server on the instance. Once the load balancer gained access to my instance, it gets In Service.

I checked it with tail -f /var/log/apache2/access.log in my instance, to verify if the load balancer was trying to access my server, and to see the answer the server is giving to the load balancer.

Hope this helps.

查看更多
疯言疯语
7楼-- · 2019-03-11 15:10

If your web server is running fine, then it means the health check goes on a url that doesn't return 200.

A trick that works for me : go on the instance, type curl localhost:80/pathofyourhealthcheckurl

After you can adapt your health check url to always have a 200 response.

查看更多
登录 后发表回答