Minimal rsync process for multinode web cluster

install rsync pkg if not installed on every node

yum install rsync

choose a “master node” to take code from, in our example we name it node1 and the others node2,3,4 etc

useradd rsyncuser
cat /home/ec2-user/.ssh/authorized_keys

copy the auth key inside

su rsyncuser
cd /home/rsyncuser
mkdir .ssh
chmod 700 .ssh
vi .ssh/authorized_keys

paste the key in your clipboard

chmod 600 .ssh/authorized_keys

NODE 2,3,4
mkdir /root/keys
vi /root/keys/node1rsync.key

and copy inside your node1 ec2 private key

chmod 600 /root/keys/node1rsync.key

now you can launch an rsync command from node2,3,4 to node1 every X minutes

crontab -e

and add

*/X * * * * /usr/bin/rsync -avzhe "ssh -i /root/keys/nide1rsync.key" rsyncuser@NODE1_IP_OR_FQDN:/var/www/vhosts/ /var/www/vhosts/



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s