cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5925
Views
2
Helpful
2
Comments
Orf Gelbrich
Cisco Employee
Cisco Employee

Automating the UCSD internal DB Backup for a single node deployment:

The crontab entry

==============+

[root@localhost etc]# crontab -l

1 2 * * 0 /usr/local/etc/DB_BACKUP > /dev/null 2>&1

The Script on UCSD

=================

[root@localhost etc]# cat /usr/local/etc/DB_BACKUP

#!/bin/sh

# server login password localfile remote-dir

upload_script(){

      echo "verbose"

      echo "open $1"

      sleep 2

      echo "user $2 $3"

      sleep 3

      shift 3

      echo "bin"

      echo $*

      sleep 10

      echo quit

}

doftpput(){

        upload_script $1 $2 $3 put $4 $5 | /usr/bin/ftp -i -n -p

}

/opt/infra/stopInfraAll.sh

/opt/infra/dbBackupRestore.sh backup

BKFILE=/tmp/database_backup.tar.gz

if [ ! -f $BKFILE ]

then

  echo "Backup failed. "

  return 1

fi

export NEWFILE="cuic_backup_`date '+%m-%d-%Y-%H-%M-%S'`.tar.gz"

export FTPSERVER=172.17.32.110

export FTPLOGIN=cisco

export FTPPASS=cisco

doftpput $FTPSERVER $FTPLOGIN $FTPPASS $BKFILE $NEWFILE

nohup /opt/infra/startInfraAll.sh &

exit 0

mkdir /usr/local/etc

vi /usr/local/etc/DB_BACKUP

  cut and paste above text

chmod +x /usr/local/etc/DB_BACKUP

Update crontab

     set -o vi

     crontab -e

Ideas for Multi Node Backup

=======================

(1) Enable SSH on all hosts with pub key from Inventory DB.

(2) Write a script in such a way that from Inventory, it shutdown all primary, service nodes (hardcoding the IPs)

(3) Invoke a local backup command on the  inventory node and copy the backup to NFS

(4)  Invoke a remote backup command on the monitoring node and copy the backup to NFS

(5)  Start Service nodes, Primary nodes

Put this in a cron on Inventory node.

Another contribution by:

     Alejandro Madurga Ainoza

Python scripts to stop the services on a multimode (single node work as well)

In this case customer wanted to store the backup on a server filesystem (that could be NFS mounted).

Scripts attached, they call the OOTB backup scripts but avoid the FTP steps.

Comments
yshtoots
Cisco Employee
Cisco Employee

Does UCSD DB backup and restore is enough for full UCSD restoration from scratch?

Orf Gelbrich
Cisco Employee
Cisco Employee

Yes it does. But the dB coming and going to has to match the ucsd version

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links

Review Cisco Networking for a $25 gift card