- What if I have a large number of web servers and I need to deploy the same code on all of them?
- What if I would like to enable high availability and redundancy for static user content such as images?
- What if I want to to backup files to a central storage?
A Swiss knife for static content replication
rsync was considered for a long time as the best solution for static content and code replication in environments that consist of large number of servers.
rsync has a simple protocol that replicates a directory (one or more) on a single server to other servers. This can be achieved in two different methods (like SCP that it is based on):
- Push from the master to the slave: rsync [OPTION] … SRC[SRC] … [USER@]
- Pull from the server by the slave: rsync [OPTION] …[USER@]HOST:SRC [DEST]
Can I perform a change on the destination directory?
Please note that the rsync protocol analyzes differences between two directories, and therefore probably will not match cases when you want to change the content of the destination directory.
How should I authenticate?
Use one of the two options:
- Static user/pwd using sshpass for non interactive SSH based authentication.
- PKI authentication using on-the-fly keys generation or pre-generated keys
Note: you may consider using OpenStack Storage for these purposes as well, as it provides an out the box solution for high availability and redundancy that easily supports multi master out of the box