Haproxy Load Balancer, EC2, recording my own accessibility script

I reviewed high availability solutions like heartbeat and kept moving to failover when haproxy load balancing goes down. I realized that although we would like to get high availability, at the moment this is not a prerequisite in order to do this in the amount of expenses associated with the fact that two instances of load balancing work at any given time, so that we get instant transfer to another resource (in particular, how one pound will be redundant in our setup).

My alternative solution is to start a new instance of EC2 load balancer from AMI if the current load balancer has stopped working and connected it to the elastic ip that our domain name points to. This should ensure that downtime is limited by the time it takes to start a new instance and associate an elastic ip, which, given our current circumstances, seems like a reasonable cost-effective solution for high availability, especially since we can easily make this multi-av zone. I want to do this by following these steps:

  • Prepare AMI load balancer
  • Run one instance of ec2 acting as a load balancer and assign it an Elastic IP.
  • Ask the microserver to regularly check the current load balancer (we always have an additional microserver that works anyway)
  • If ping expires, start a new instance of EC2 using the AMI load balancer
  • Link elastic ip to new instance
  • Shut down the old instance of load balancing
  • Repeat step 3 with a new instance.

I know how to run commands in my script to start and close EC2 instances, bind an elastic IP address to an instance, and a ping server.

My question is what would be a suitable ping here? Is regular ping at regular intervals sufficient, and what would be a good interval? Or is it a rather simplistic approach, and is there a more reasonable health check that I have to do?

Also, if anyone anticipates any problems with this approach, feel free to comment

+4
source share
2 answers

I understand exactly where you are from, my company is in the same position. We take care of having a highly affordable fail-safe system, however the overhead is simply not viable for the traffic we receive.

  • One of the problems with your solution is that you assume that the micronode and load balancing will not die at the same time. Having experience working with amazon, I can tell you that this can happen, as if it is unlikely that it is possible that everything that makes your load balancer die also removes the micro-instance.
  • Another potential problem is that you can also assume that you can always start another replacement instance during downtime. This is simply not the case, for example, the smeared Amazon in our Vostok-1 region a few days ago. A power outage led to one of their zones losing power. When they regained power and started recovering cases, their API was not working properly due to the net workload. During this time, it took almost 1 hour before they were available. If a trip like this knocks out your load balancer and you cannot start another, you will not.

It is said. I believe that the ELB provided by amazon is the best solution for me. I'm not sure what explains the use of HAProxy, but I recommend exploring ELB as they will allow you to do things like autoscaling, etc.

For each ELB you create, Amazon creates one load balancer in each zone with a registered instance. They are still vulnerable to certain problems during serious outages on Amazon, as described above. For example, during this downtime, I could not add new instances to load balancers, but my current instances (those that were not affected by the power outage) still served requests.

UPDATE 2013-09-30

We recently changed our infrastructure to use a combination of ELB and HAProxy. I believe ELB provides the best availability, but the fact that it uses DNS load balancing doesn't work very well for my application. Thus, our setup is ELB in front of the HAProxy 2 node cluster. Using this tool HAProxyCloud I created for AWS. I can easily add auto-scaling groups to HAProxy servers.

+6
source

I know this is a little old, but the solution you offer is too complicated, there is a much simpler method that does exactly what you are trying to accomplish ...

Just put your HAProxy machine with your custom AMI in an autoscale group with a minimum and a maximum of one instance. Thus, when your instance goes down, ASG will return it back, EIP and all. No external monitoring is required, as well, if not faster to respond to downed instances.

+1
source

All Articles