Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to have v1 of my application in one pool and version v1.1 in another pool and then slowly ramp up the traffic going to pool two and reduce it to pool one.

Can anyone show some concrete examples of doing this with HA Proxy, Varnish, Nginx or something else?

share|improve this question
    
And how you intend to you mange the database schema changes? –  Mircea Vutcovici May 1 '12 at 16:05
1  
Schema changes can best be approached by staggering the change. Add a new column in v1.1, use the column in v1.2, stop using the column in v1.3, delete the column in v1.4. –  markba May 1 '12 at 16:08
add comment

1 Answer

up vote 3 down vote accepted

The split clients module is designed specifically for this:

# I like starting my upstream names with _
# so they're not confused with hostnames
upstream _old_upstream {
  server 127.0.0.1:1234;
}

upstream _new_upstream {
  server 127.0.0.1:4321;
}

# Make sure the values here match the names of the upstream blocks above
split_clients $remote_addr $split_upstream {
   10% _new_upstream;
   -   _old_upstream;
}

server {
  location / {
    # EDIT: I forgot, when using variables in a proxy_pass, you have to
    # specify the entire request
    proxy_pass http://$split_upstream$request_uri;
  }
}

Then, as you want to move more traffic to the new server, just change the percentage and run nginx -s reload.

share|improve this answer
    
Thank you, I'll give this a try. –  markba May 1 '12 at 16:29
    
I updated the config because I forgot that you have to specify the entire request when using variables in a proxy_pass –  kolbyjack May 1 '12 at 16:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.