masternode

Cluster Backup
The following is a procedure which will allow you to do automatic backups from the
cluster to the Westgrid storage facilities.
1. Obtain a Westgrid account (your supervisor should have a Westgrid Project ID for
you to join). If your supervisor does not have a Westgrid Project they should apply for
one. http://www.westgrid.ca/support/Applying_for_an_Account 2. Login to masternode.eche.ualberta.ca ● ssh masternode.eche.ualberta.ca then from masternode (the master node for the cluster), ssh to the Westgrid storage
facilities at blackhole.westgrid.ca
● ssh blackhole.westgrid.ca
set up the ssh at blackhole to allow silent logins by copying your public ssh key
(id_rsa.pub) from masternode to your file .ssh/authorized_keys on
blackhole.westgrid.ca (NOTE that if you want to do automatic backups from more
than one machine, the public key from each machine must be appended to the .
ssh/authorized_keys files as separate lines). As an example you could use the
command
● scp masternode.eche.ualberta.ca:.ssh/id_rsa.pub .ssh/id_rsa.pub­ masternode
This will copy the public ssh key from masternode to your .ssh directory on the Westgrid
storage facility at blackhole.westgrid.ca. You must now add this key to your
authorized_keys file. One way to do this is to concatenate the public key to the
authorized_key file by changing to the .ssh directory ● cd .ssh
then using the command
● cat id_rsa.pub­masternode >> authorized_keys
3. On the Westgrid computer, setup a symbolic link from your home directory to your
vault storage location (check out the Westgrid website for the reason for using vault).
Ensure that you are back on your home directory (just use the cd command), then use the
command
● cd
● ln ­s /vault/$USER vault
4. Exit from blackhole and check that the silent logins work by using
● exit
●
ssh blackhole.westgrid.ca
You should be logged in without a password. If you are not, then something is wrong and
the automatic backups will not work. Exit from blackhole again to get back to
masternode.
● exit
If the login did not work you will need to fix the problem before continuing to the next
step.
5. You can use rsync on masternode to backup to the storage space on Westgrid. This
will be easier if all the files you want to backup are under one subdirectory in subordinate
subdirectories and files to that subdirectory. For example you could have a subdirectory
called ExperimentData then other subdirectories (such as Run1, Run2 etc.) under that
which contain either more subdirectories or files. The following command would archive
all the subdirectories and files for your data subdirectory to your Westgrid storage space
● rsync ­e ssh ­az /home/<loginID>/ExperimentData blackhole.westgrid.ca:vault
NOTE: ­ replace <loginID> with your login ID
rsync is efficient because, if the ­a option is used, after files are archived rsync only
archives changed files. Information about rsync is available at http://rsync.samba.org/documentation.html
http://www.jdmz.net/ssh/
6. Set up a cron job to do the automatic backups by using the crontab command. For
information about the crontab command, use the command ● man crontab
As an example if you want the directory ExperimentData (from the example above)
backed up daily at 7:00 PM you use the rsync command in a cronjob entry. To set up a
cron job use the command
● crontab ­e
This command opens the cron table for editing. Insert the line
0 19 * * * rsync ­e ssh ­az /home/<loginID>/ExperimentData blackhole.westgrid.ca:vault
Each day at 7:00 PM (note the 24 hour format for the command), the rsync command
should be run to backup any changes in the directory ExperimentData to Westgrid.
In order to try to balance the network load somewhat I recommend that not all cron jobs
be started at the same time. I have set up a table of suggested start times associated with
the first letter of your login.
First Letter
Start time
a,b or c
21
d,e or f
22
g,h or i
23
j,k or l
24
m,n or o
1
p,q or r
2
s,t or u
3
v,w or x
4
y or z
5
So for myself with login barton I would set up a cron job
0 21 * * * rsync ­e ssh ­az /home/barton/ExperimentData blackhole.westgrid.ca:vault
which would start the cron job at 9:00 PM daily to copy any changed files in my
ExperimentalData directory to backup storage on Westgrid.