rsync: directory sync between backends

We used to have a samba share sync on the myp2p backends. But this is pretty instable. Rsync, through ssh is much more convenient.. if you know how it works.

Ok, so we have our main server where every backend mirros some files from. Every backend executes the command:

1
rsync -avzR -e ssh myp2p@77.247.179.67:/home/myp2p/public_html/feeds /

All feeds get properly copied to /home/myp2p/public_html/feeds, on the local machine (backend). In order not to get a password prompt, we’re going to put an authorization on the main server. Perform on the backend:

1
2
su myp2p
ssh-keygen -t rsa

Now copy the content of the created file (~/.ssh/id_rsa.pub) into the ~/.ssh/authorized_keys, for the desired user on the main server, onto a new line. Executing the rsync command will now go without password prompt.

Leave a Reply

You must be logged in to post a comment.