Hi Jens,

I'm using names which resolve to internal EC2 addresses in haproxy configs - the /etc/hosts of all instances are auto updated then new instance is added/removed. But the problem manifests then the instance is stoped and then started - this makes the internal ip to change. I can also use DNS CNAMES to public instance ip with very low TTL - which get auto updated then instance boots by using route53 - but it's still the same problem - the ip changes in DNS and not in /etc/hosts (getnameinfo does not really care from where from the name is resolved) - in both cases haproxy will not know it has changed since it probably uses getnameinfo once only on startup/reload. And never later rechecks if the ip has changed.

Thanks
Alex

On 08/04/2011 11:45 PM, Jens Bräuer wrote:
Hi Alex,

I know my answer is not strictly related to HA-Proxy, but its use in EC2, so I 
hope its ok to post it.

Would a possible solution to your problem be to use internal EC2 addresses? 
Since now, the only situation where the behavior you describe would occur is 
the following:
- start new EC2 instance
- add it to HA-Proxy
- assign ElasticIP to instance (which will cause the IP to change).

Are there other situations?

CU,
Jens

On 04.08.2011, at 17:12, Piavlo wrote:

Hi,

I'm running haproxy in ec2 environment - and there is one problem I noticed.
The backend servers are configured as names and not ip - if backend server IP 
changes
and even if the /etc/hosts on haproxy server is updated - haproxy does not 
catch this change.
It has to be restarted to catch this change - now is there builtin haproxy 
configuration work around for this?

I can think of many ugly&  unreliable workarounds - but the most natural seems 
to be - if haproxy backend healthcheck
is failing (or more specifically it fails to connect to backend) it should try 
to check if the backend ip has changed with getnameinfo and update it if needed
before each healtcheck. This way there is no need to reload/restart haproxy by 
external tools - as well statistics will not be lost.

Is there chance for this feature to be  implemented?

Thanks
Alex



Reply via email to