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 architecting a new server structure and I plan to have two apache workhorses and a sql database behind both of them. I was wondering what the best way to mirror the data between the apache servers is. User data should be limited on these servers as most of it will be in the could with S3.

From the prelimiary research I've done so far I've read about GlusterFS and DRBD, but would a simple rsync script do the trick?

share|improve this question

1 Answer 1

Honestly I wouldn't suggest doing live-time replication between the apache machines. Have them have their own code, or rsync from the "main" server every so often. live-time (or near) is a lot of file inspection that just isn't necessary 99% of the time.

Personally i would recommend having three layers.

Load Balancing / Web Servers (your http/php processes)

File Servers (code/files that are needing to be shared across all web nodes)

Database Servers (your backend databases)

A lot simpler then having to do full replication between servers.

If you dont have the ability to have a dedicated file server (NFS/ect), Have "Web2" Mount "Web1's User Uploads", Both webservers will be able to read & write to the shared area, no syncing ect required unless your updating website code.

Web1
/var/www/website/www
/var/www/website/_files

web2
/var/www/website/www
/var/www/website/_files (NFS mouned to Web1)
/var/www/website/_files.bak (rsync copy from web1 incase web1 explodes)

Both servers are near-livetime in terms of storage, they're redundant, and you dont have to add in any complex syncing nonsense.

edit:

http://www.migrate2cloud.com/blog/how-to-setup-nfs-server-on-aws-ec2

there's a guide on how to use NFS on an EC2 instance.

share|improve this answer
1  
+1 : GlusterFS and DRBD require alot of work, which may not be worth it for a two servers. –  Stefan Lasiewski Aug 5 '11 at 23:02
    
Exactly my thinking as well, They're perfectly acceptable options at a very very large scale. –  GruffTech Aug 5 '11 at 23:11
    
Could you explain more details between www and files? Is NFS or Web1 a single point of failure? –  quanta Aug 6 '11 at 7:12
    
I like the idea of just rsyncing between the two servers as the coding will often not change. The reason that I brought up GlusterFS and DRBD is for scalability in the future. But as quanta points out, isn't the NFS server a single point of failure? I can't afford another two servers to make a NFS cluster. But going back, my main reservation with rsync is what happens if I load balance and a user is directed to "newer" server and on the next refresh is sent to the "older" server? –  bswinnerton Aug 6 '11 at 23:53

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.