Had a hard time using rsync today although I had used this so many times in the past. So I decided to take a note of what I missed. Scenario – pushing and syncing files from master to slave server.

Firstly, make sure you had rsync installed on both servers and not just on the master server. That’s the mistake I made by not installing rsync on the slave server.

sudo apt-get install rsync

Next problem I had was that both my servers were setup on AWS and only had secure login via my private key. So in order for rsync to work, I had to use the execute the ssh with the private key in order to rsync files to the other server. Important not here is that the -e (execute statement) must be the last one to be executed

rsync -av --exclude pg_xlog --exclude postgresql.conf /var/lib/postgresql/9.1/main/ --progress -e 'ssh -i /home/admin/.ssh/pgs-aws.pem' root@

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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s