1

I have 2 web servers in a load balanced set (port 80) on the Azure platform. I need to ping a php file on each server which forces them to update, but how can I do this?

Can I access them like this:

http://cloudservice.cloudapp.net:8002

And set an endpoint for 8002 as well as getting Apache to listen for that port?

I tried doing that and I get

Oops! Google Chrome could not connect to cloudservice.cloudapp.net:8002
Adam
  • 349
  • 3
  • 12
  • http://cloudservice.cloudapp.net is probably the load balancer, you want to go directly to the http://ip_address/file.php or unique (for each server) http://hostname/file.php to bypass the load balancer, you don't need to configure another extra port, although you could if you want to. – LinuxDevOps Mar 20 '14 at 17:30
  • Add a script to cron on each system to connect to itself? – Zoredache Mar 20 '14 at 17:33
  • The IPs of the servers are the same unfortunatly – Adam Mar 20 '14 at 18:15
  • I could do a cron, but I'd rather push to deploy – Adam Mar 20 '14 at 18:16
  • @LinuxDevOps - that's not how Azure works. If you place more than one vm in a cloud service, they share a single IP address. The question is around using load-balanced endpoints (balanced across a number of vm's that listen on that port). – David Makogon Mar 24 '14 at 01:13

1 Answers1

1

For a load-balanced endpoint, you cannot use that specific endpoint to reach a specific vm. The load balancer will distribute the calls outside of your control.

You can, however, open additional ports, one per vm, which is a port-forward endpoint. That means it will only go to a specific vm. You could then do something like allocating port 8000 to vm0, 8001 to vm1, etc. Then, for the port mapping, you can map each of these external ports to the same internal port (maybe 8000?). At that point, you set up a listener on port 8000 on each vm, looking for the request for the specific php file.

In essence, you'll end up with two ports open per vm: 80 and 800x (ok, others like ssh/rdp/ssl/etc. but I'm just talking about endpoints you referenced in the question).

David Makogon
  • 2,767
  • 1
  • 19
  • 29
  • Thanks I got it working! Slightly off topic, but say I want to roll out 100 VMs, I need to SSH onto each one and assign it a port in Apache conf, and then match it in the azure portal, if there a way you know of automating this? – Adam Mar 24 '14 at 13:17