UCSD internal DB backup example (Single Node)

Version 3

    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



    # server login password localfile remote-dir


          echo "verbose"

          echo "open $1"

          sleep 2

          echo "user $2 $3"

          sleep 3

          shift 3

          echo "bin"

          echo $*

          sleep 10

          echo quit




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




    /opt/infra/dbBackupRestore.sh backup


    if [ ! -f $BKFILE ]


      echo "Backup failed. "

      return 1


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

    export FTPSERVER=

    export FTPLOGIN=cisco

    export FTPPASS=cisco


    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.