John, As you are using cookies it is safe to use the standard soft reload on HAProxy. So just change the configuration file as required and restart.
We have a (very) simple API script on our EC2 (HAProxy based) appliance which allows auto-scaling servers in the cluster to register their IP address with the HAProxy load balancer and automatically join the cluster when they boot: Assuming your dynamic servers have the same SSH key, they can just locate the load balancer by DNS and run the API command remotely, passing their own IP details. http://www.loadbalancer.org/ec2.php You would put something like the following in the init script on your dynamic (auto scaling) servers: #!/bin/sh PATH="/sbin:/bin:/usr/sbin:/usr/bin"; AMI_KEY_PAIR="<path-to-ssh-key>"; EC2_LOADBALANCER_IP="<ip-address-of-ec2-loadbalancer>"; CURL=`which curl`; SSH=`which ssh`; AMI_ID="`$CURL -s http://169.254.169.254/latest/meta-data/ami-id`"; AMI_IP="`$CURL -s http://169.254.169.254/latest/meta-data/local-ipv4`"; case "$1" in start) $SSH -i $AMI_KEY_PAIR root@$EC2_LOADBALANCER_IP \"lb_modify -l $AMI_ID -d $AMI_IP \"; exit 0; ;; stop) $SSH -i $AMI_KEY_PAIR root@$EC2_LOADBALANCER_IP \"lb_modify -l $AMI_ID -d $AMI_IP -r \"; ;; *) exit 1; ;; esac; exit 0; On 8 February 2012 01:09, John Langley <[email protected]> wrote: > We are looking for a solution for "sticky bit routing" based on > cookies that will run on Amazon's EC2 cloud. > > I've looked at the architecture guide for HAProxy (although not the > source yet) and it ~may~ be capable of doing what we need, but I > thought I'd ask the mailing list to see if anyone else has already > tried this solution. (Without knowing the implementation, it's > impossible to say if our requirements can be met by the > implementation) > > The challenge that we have is that unlike a traditional system where > the sticky bit routing would be to one of a set of predefined servers, > in our case, the servers will be created dynamically in the cloud. We > can't "configure" them when we start the HAProxy routing layer. > Although we may have some "back up" servers, that can be used if no > cookie is in the request OR if the cookie specifies a server that has > died, in general the servers that the cookie will be specifying will > be dynamically created and we will assign them to the requests > "ourselves" (not needing the nginx layer to round-robin assign them to > one of a pool of fixed address servers). > > So my question may come down to: "Can HAProxy route to servers not > predefined in the initial configuration"? I can easily imagine an > implementation that could handle this, but wanted to ask if HAProxy > already does this. > > Thanks in advance > > -- Langley > -- Regards, Malcolm Turnbull. Loadbalancer.org Ltd. Phone: +44 (0)870 443 8779 http://www.loadbalancer.org/

