Everything Java Apache Geospatial Open Source. Hello Shinning Stars!!! Vincent Massol, Raphael Luta, Santiago Gala, Carsten Z.

Thursday, November 16, 2006

I've been doing alot of security lately and I need to backup some derby databases from one machine to another. The backup strategy is simple create an compressed archive and copy it using a secure connection to another machine. I'm documenting the process here. I want to backup a directory found at /path/parent/data. And I want the archive to maintain the directory data so that when it is expanded it writes one directory data and all the contents below it.

cd /path/parent
tar czf /tmp/data-`date +%j`.tar.gz data

The archive name is created with a %j indicating the day of the year. Therefore maintaining a year of backups. The next year will start to overwrite previous backups.

Then we want to copy the data to a remote machine. A secure encrypted copy can be sent to the remote machine. But in order to incorporate this in a cron job the remote machine must accept a password-less connection. These are the steps to generate the key. Run ssh-keygen without providing a passphrase.

ssh-keygen -t rsa
scp ~/.ssh/id_rsa.pub remoteuser@remotemachine:.ssh/authorized_keys2

Now remote connections can be made without providing a password. Meaning the remote machine trusts the local machine.

No comments: