ALB - nginx proxy_next_upstream functionality

0

nginx has a feature called proxy_next_upstream where it will retry a request against another upstream if an error occurs on the 1st upstream it tries, such as an error, timeout, or certain http code:

https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_next_upstream

Does similar functionality exist in an ALB where it retries a request against another target if the 1st target fails?

In my example, I have 2 EC2 webservers behind an ALB, and if I reboot one of them or it has another issue, could the ALB immediately start redirecting traffic to the other EC2? I have the Health Check at 5 seconds, but hoping to avoid the downtime waiting for the Health Checks to fail.

Or is there another way to avoid downtime in a scenario like this?

Thank you for your help.

質問済み 7ヶ月前673ビュー
1回答
0

If you need to reboot an EC2, remove it from the target group before you reboot it so that the connections are drained and you don’t have the issue waiting for the health checks to time out.

After the reboot add it back in.

You can do this automatically such as when patching using SSM lifecycle.

profile picture
エキスパート
回答済み 7ヶ月前
profile picture
エキスパート
レビュー済み 7ヶ月前
  • Thanks, I will check into removing the EC2 from the target group for reboots. Are there any options for unplanned outages such as if the webserver stops responding? I see the minimum HealthCheckIntervalSeconds is 5 and UnhealthyThresholdCount is 2, so I believe that means there will be at most 10 seconds of downtime where end users will get http 502 errors trying to access my website. Is there any way to have a faster failover since I already have a 2nd (or 3rd or more) webserver in the load balancer?

    I suppose I could write my own script to check the webserver health on a faster interval and remove it from the target group myself, but curious if there was a better way.

    Thanks again for your help.

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ