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.

In the process of deploying multiple EC2 instances running a Rails app over Unicorn. I currently have a "front end" server running nginx with multiple "Unicorn" upstream providers.

At night, I'd like to turn off a few unicorn servers and in the morning boot them up again (which I have working fine).

Should I also be removing/commenting out the upstream providers in my nginx conf and then doing a nginx config load? (To stop nginx from trying to send clients to my switched-off ec2 instances).

Is there a better way to handle this? (HAproxy perhaps?)

share|improve this question

1 Answer 1

I think one of the simplest ways to implement this, is to use LVS. With LVS you could create a virtual server to be the backend of your Nginx, possibly on the localhost of each Nginx itself. Then you just point the Nginx upstream to the LVS Virtual Server. The Unicorns are the backends of the LVS, defined as server-address.

That way it should be really easy to add/remove backends from the Virtual Server via some cronjob, because you can do these actiones via simple ipvsadm commands.

Of course it would also be possible to add/remove servers from the Nginx upstream definition via some scripts, but I would regard the LVS solution to be much easier to script and less likely to fail.

share|improve this answer
    
LVS seems overkill for what I'm trying to achieve. Cheers though. –  Jamsi Feb 21 '13 at 1:11

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.