简体   繁体   中英

AWS ELB when target (backend) applications runs on multiple ports of the same EC2

I have 2 instances of the same web application running on port 8080 and 8081. I need to load balance using ALB/CLB. This used to be a simple thing in good old apache web server.The requirement is to load balance the instances below

Instance 1 Web App 1 Port 8080

Instance 1 Web App 2 Port 8081

Instance 2 Web App 1 Port 8080

Instance 2 Web App 2 Port 8081

I am not able to do this with ALB. I have tried creating 2 target groups, one for port 8080 and the other for port 8081. But in the listener rule, I can send the requests to different target groups based the path. But that is not going to load balance the whole site as such. Refer the screenshot

在此处输入图片说明

What are my options here ?

Thanks in advance

In an ALB, create one target group, adding each instance to the group, twice -- once for each port.

You can register each EC2 instance or IP address with the same target group multiple times using different ports, which enables the load balancer to route requests to microservices.

https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-target-groups.html#registered-targets

Note that this assumes what you are calling "app 1" and "app 2" are in fact the same application, just two different processes, as you described.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM