NBU Scripts Sync

From World History Wiki
Jump to: navigation, search
World History Wiki is Brought to you by:
S.J.'s Adventures


Creating a common directory that is synced across NetBackup Domains had help greatly with insuring custom scripts for reporting and administration are consistent.

For example:

A if "/.../nbu/bin" and "/.../nbu/etc" directories are synced daily from the version on MAIN-MASTER to all the international sites. This document explains how this is managed.

Requirements

Requirements: RSYNC, Passwordless SSH, & a User Account.

rsync Account

A "rsync" account is setup on each of the NetBackup servers.

The password for this account is kept in "xxxxx" which is encrypted.

Paths and Times

The Paths get synchronized daily at @ 19:00 DDC local time. The source data is stored on the DDC master in these locations:

/xxxx/nbu/bin
/xxxx/nbu/etc

SSH and rsync must be configured on the following servers:

xxxxx

Configuration Steps

These are the steps for configuration on a new Server to be synced to:

1. Create User Account

Open a ticket to have the UNIX admins create the 'rsync' account to the new client as a member of the 'nbu' group and a password you can remember.

2. Setup Password

Change the password for the 'rsync' account to the password listed in "xxxxx".

3. Create SSH key

Create the local key necessary for the rsync account using the ssh-keygen -t rsa command.

-bash-3.00$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/rsync/.ssh/id_rsa):
Created directory '/home/rsync/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/rsync/.ssh/id_rsa.
Your public key has been saved in /home/rsync/.ssh/id_rsa.pub.
The key fingerprint is:
XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX rsync@hostname

4. Copy SSH Key

Create the authorized_keys file on the client by secure-copying the id_rsa.pub to the client from MAIN-MASTER and renaming it in the process. Then test the passwordless login.

[rsync@MAIN-MASTER ~]$ scp .ssh/id_rsa.pub hostname2:~/.ssh/authorized_keys
Password:
id_rsa.pub  100%|***********************************************************************************************|   228       00:00
[rsync@MAIN-MASTER ~]$ ssh hostname uname -n
hostname

5. Check rsync

On the client check to see if rsync is installed. If rsync is not installed in /usr/bin/ you need to take note of the install location for later communication steps. See the example provided below where the first server has the common path to rsync but the second example has the non-common (Solaris) path.

[rsync@hostname ~]$ which rsync
/usr/bin/rsync
[rsync@hostname ~]$ which rsync
/opt/sfw/bin/rsync

6. Test rsync

Test the rsync process between MAIN-MASTER and the new client. If this test fails you will need to work with the Unix Admins to ascertain where the problem lies. If this step is successful, you can proceed to the following steps.

For clients with the common rsync install path...

[rsync@MAIN-MASTER ~]$ rsync -av /xxxxx/nbu/bin <newclientsnamehere>:/xxxxx/nbu/bin

For clients with the non-common (Solaris) install path...

rsync -av --rsync-path=/opt/sfw/bin/rsync /..../nbu/bin <newclientsnamehere>:/..../nbu/bin

7. Update Crontab

With SSH keys setup and working properly, you can now add the new client to the crontab for rsync on MAIN-MASTER. See the example crontab below to determine how to add the new client. Remember to use this argument:

--rsync-path=/opt/sfw/bin/rsync

for clients that use a path other than the common install path for rsync.

/usr/bin/rsync

Make sure when adding the new client that you update the output file path in the to differentiate the location/name of the new client.

As the nbusync user, run the crontab -e command on MAIN-MASTER.

****WARNING**** THIS STEP ASSUMES FAMILIARITY WITH THE TEXT EDITOR VI****

[rsync@MAIN-MASTER~]$ crontab -e

8. Verify Logs

After the next 19:00 cron scheduled run of the rsync processes, check the log file specified in the crontab to ensure the process completed successfully.

9. Update Document

Add the new client to the "Destination Server(s)" section at the top of this document.

10. Notify Team

Email the "Netbackup Team" to notify the team of the new client's addition to the rsync procedure and the successful first run.

Example Crontab

[rsync@hostname ~]$ crontab -l
##############################################
## RSYNC of /...../nbu/etc & /...../nbu/bin  #
##############################################
* 19 * * * /opt/sfw/bin/rsync -av /xxxxx/nbu/bin/ hostname1:/..../nbu/bin > /xxxxx/nbu/logs/cron/rsync/ldc_bin.out 2>&1
* 19 * * * /opt/sfw/bin/rsync -av /xxxxx/nbu/etc/ hostname1:/..../nbu/etc > /xxxxx/nbu/logs/cron/rsync/ldc_etc.out 2>&1
#########################
# End of NBU RSYNC      #
#########################



Back to NetBackup