0

I have configure my VM in such a way that I have 2 application running on one VM. First App listen on ip:80 port Second App listen on ip:8080 port

I have enabled ports on VM instances group like this.

enter image description here

I have my Load Balancer configured with two front rules like this.

enter image description here

I want to map ip1:80 to my 80 port application and ip2:8080 to 8080 application

when I tried accessing my application using load balancers IP address it always show me 8080 port application.

I have two backend service running help me here google team. I m newb

Grzenio
  • 35,875
  • 47
  • 158
  • 240
Tejas
  • 358
  • 5
  • 23
  • but what is the endgame here? are you using the load balancer to autoscale? or you just want two diffrent ip addresses? – Amir Rahwane Oct 21 '17 at 11:50
  • of course I want to use this for autoscale. I thought 2 different IP address for 2 ports. Am I doing something terribly wrong??. my 2 applications are nodejs and socket.io. I have a startscript which runs these 2 on port 8080 and 80 automatically on autoscale. – Tejas Oct 21 '17 at 12:03
  • my auto scaling works, specified number of VM scales on load – Tejas Oct 21 '17 at 12:19
  • As far as I know url mapping woks with hostnames not ips. You can also create another group with the same image template but on the second group map the port name "http" to port 8080. there is no such thing as port name "http80" as far as I know. – Amir Rahwane Oct 21 '17 at 12:23
  • and then I have to pay for 2 VMs, isn't it? – Tejas Oct 21 '17 at 12:31
  • let say If i buy a domain?? will it work?? – Tejas Oct 21 '17 at 12:38
  • you are correct you will need the minimum of 2 vm. if you buy a domain you can use the solution I gave in the other question. – Amir Rahwane Oct 21 '17 at 12:52
  • for testing purposes you can just edit you local hosts file to see if it works. it will also mean you will no be using XX.XX.X.X:8080 to reach your website but a sub.domain.com – Amir Rahwane Oct 21 '17 at 12:53

2 Answers2

0

If you want to use IP addresses but not URLs/Domain(s) to reach to your web applications, then URL Maps cannot help to implement your design, as URL map forwards the request to the correct backend service using host values (example.com) and path values (/path) in the destination URL.

That being said, you can add one more Target Proxy to your LB resources to route incoming requests directly to the desired backend services. This will allow you to keep your minimum number of instances as one VM.

For more information, visit this article.

Kamran
  • 3,397
  • 26
  • 40
0

I had similar problem and I had to add second backend. So I have two backends: one for 80 port, other for 8080. And I have on managed group.

Maxim Yefremov
  • 13,671
  • 27
  • 117
  • 166