Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got the problem that I don't know a lot about server administration and right now we've got 2 Servers behind a load balancer and I need to sync the htdocs folders from apache.

I think the biggest Problem is, i don't have root access the the Servers just a "normal" ssh-user and ftp.

I hope you have got some ideas for me how to manage this.

share|improve this question
up vote 5 down vote accepted

You can simply use rsync such as:

$ rsync -au src dest

Any of the src and dest can be written as user@host:src if it is not on the local machine. This uses ssh by default.

You don't need root access if the provided user has enough permissions on both servers to read and write the files/folders.

share|improve this answer
Run rsync with the "-n" option to do a "dry run". It'll tell you what it's going to do without actually writing. And be careful of trailing slashes at the end of "src" and "dest", i.e., with the wrong set of slashes rsync will stuff "src" into "dest/src". Look at rsync documentation. – cjc Dec 7 '11 at 15:10
It's important if you have any doubt about the correctness of your command :) – Khaled Dec 7 '11 at 15:12
right now i tried this but i got a problem with the keyfile wich is needed to automaticly login. i dont get no errors but its still prompting for the password. rsync -aun -e "ssh -i /kunden/343193_51373/.ssh/authorized_keys/" user@host:/kunden/343194_51373/webseiten /kunden/343193_51373/webseiten where is the problem? – Frederick Behrends Dec 8 '11 at 9:50
You need to make you generate the key files without passphrase. Then, you need to copy the public key file (with correct permissions) to the other machine user folder ~user/.ssh/authorized_keys. – Khaled Dec 8 '11 at 10:08
this is what i did, i created the keyfile on web2, copyed it to web 1 and started the command on web1, the keyfile is found by rsync otherwise i get the error (no file or directory). – Frederick Behrends Dec 8 '11 at 10:18

You can use something like rsync with cron to mirror the files at regular intervals. The downside to this is that the synchronization is not realtime, but rather at whatever interval you set.

If you need immediate syncing to all nodes in the group, you should look at something like DRDB. If you don't have root access, you'll need someone with root to set this up for you but it's well worth it.

share|improve this answer
Depending on the file system, DRBD may not be the right solution, as only DRDB node can be done active at the time. From what gather, the poster implies that both nodes need to be up and accessible. – Rilindo Dec 7 '11 at 16:10

Like the others said, rsync is a great option, but it might be an easier option to just have a networked storage device like SAN or maybe just setting up a simple network share like NFS or Samba.

I would personally just have one storage device that both servers will read off of. Either way you go, it will work out. Rysnc isn't something I would choose as you would most likely put it on a cron job and you might have some delays in updates as one server is updated but the other isn't. However, there's probably some way to have a service running 24/7 to check for changes and update the other server(s) if needed; never done it before though.

share|improve this answer

How often is new data added to the systems?

That is a key factor in deciding how to approach this.

If data is not added often, then frequent synchronization with rsync or another tool could work.

If data is added frequently, then you have to sync frequently. In this case, your need a shared storage either via NFS/Samba or clustered file systems. This however will require root access to setup.

I prefer centralized data. It is far easier to maintain, backup and secure and you avoid systems being out of sync. This is also more easily scaled to multiple apache nodes than trying to keep 10 apache servers in sync.

share|improve this answer

Your Answer


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.