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'm moving from single app server to load balanced config.

In the single server config I synchronized the sources by S3 cmd sync s3 every few minutes and on hostup (Scalr event) I sync the sources back from S3. This ensures the server will run updated sources.

What is the best practice when the number of app servers is dynamic?

Suppose I have 2 servers and server A gets an updated sources. If the sync script runs on B first, server A will get the old file from B instead of the other way around.

What is the best practice in this case?

share|improve this question

4 Answers 4

up vote 2 down vote accepted

The following are the main protocols used to centralize storage:

  • SSHFS - Transfers everything over SSH, so it's secure and may be used over the Internet with no worries. SSH supports transparent compression if you want it. However, SSHFS can be difficult to get working.

  • NFS - Inherently insecure, and uses IP addresses to distinguish rights, but usually very easy to get working.

Personally, I would try SSHFS, and fall back to NFS if it doesn't work.

share|improve this answer
    
Looks like an overkill for what I need. No simpler solution to this common problem? –  Niro Nov 1 '11 at 9:03
    
It's not overkill. With the deployment you described above, this would be a minimum... –  Soviero Nov 1 '11 at 17:04

Put your master source in S3. Have all servers only sync down (pull from S3) on startup.

When you want to update your servers:

  1. Update S3
  2. Start new instances (which will pull from S3 on start)
  3. Stop and/or Terminate your old instances running the old version
share|improve this answer

You can use inotify (inotifywait) and/or rsync. Depends on how many files you have, how often you update them and how large they are.

share|improve this answer
    
how does that work with S3? –  Niro Nov 1 '11 at 9:03
    
@Niro check out this blog post for how to use inotify and s3 ankaerith.livejournal.com/147007.html –  EJEHardenberg Aug 27 at 18:20

I'm not sure what you mean by sources, but I'm assuming you mean the web application code your servers are serving.

The best solution to this is to use a shared network file system to keep the sources updated dynamically. Two of the most popular are NFS and GlusterFS.

share|improve this answer
    
Looks like an overkill for what I need –  Niro Nov 1 '11 at 9:02

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.