Forum Discussion

nerminator's avatar
nerminator
Level 3
2 years ago

Backup of passive node with script

Hi,

I was hoping that someone could help me with task at hand.

We have 2 custom applications VMs that are in the cluster. We used to backup both of them using VMware backup policy, but during a backup of active node we have the issue that VM freezes while snapshot is taken. We know the that this happens because VM is being quiesced for the snapshot, but we cannot change this, as disk are in particular setup and it is production environment. 

So we decided to only do the backup of the passive node with VMware backup policies. We have two VMware policies each with only one vm client (one of those 2 vm nodes of the cluster). Each have a following schedules.

Daily INCR schedule

Weekly FULL schedule

  

Team in charge of the application will create script on their side that will automatically add file on the node that is passive in /etc/passive.txt. (this file will at the same time be missing on the active node)

How can I add the script in NetBackup so when the policy runs during it's automatic schedule, it checks if the client in the policy contains file /etc/passive.txt, and if it does runs backup normally, if not, than doesn't do anything. In this way one of those two policies will always do the backups and other check and skip.

I have placed 2 copies of  bpstart_notify to /usr/openv/netbackup/bin on the client and renamed them 

bpstart_notify.POLICY_NAME.SCHEDULE_NAME (for INRC and FULL schedules)

Simple if condition script in the file looks like this:

#!/bin/bash

FILE=/etc/passive.txt

if [ -f "$FILE" ]; then
exit 0
else
exit 1
fi

However backup always runs, whether the file is there or not.

Hope this makes sense.

Please help if you can.

  • Hello.

    first of all, as I remember you can not create a VM snapshot if you share disks. What type of cluster you have?

    I think that you have three (actually two) solutions to implement vm backup of the passive node. These are my thoughts. There are not full solution and you have to check them and find how to implement one of them.

    • use VMware rest api to put a tag to the inactive node and create a VIP policy with filter to backup the VM with the right tag.
      you can create a script on the client to change the tag every time the cluster service change node. I think that this is the most robust solution
    • you can create a standard policy without backup window at the schedules and add manually the two VMs,  and create a script on both nodes that will run with crontab.
      The script will check if this is the inactive node and will run a manual backup of the correct VM.
      You can start the manual backup using netbackup rest api or by running the following command on the client (you have to add the client to the servers list of the master server)
      bpbackup -i -p <policy> -s <schedule> -h <client_name>
    • if the clients and the master server are linux systems you can trust each other and create the txt to the master server. Then you can have a script on the master server to start your backup. This is not the way I like as if someone penetrate to one of the systems will have access to the others.

7 Replies

  • Hello,

    pre/post scripts dont work with VMware policy types.

    You can try VMware backups without quiescing first. If the application cluster will be still sensitive to snapshots, I recommend you to go via installing the client in VMs and filesystem policy (here you need not care about scripts because filesystem policies dont use snapshots). But cons of this approach is a more complicated recovery.

    Regards

    M.

    • nerminator's avatar
      nerminator
      Level 3

      Hi,

      Thank you for clarifying that notify_ scripts don't work with the VMware policy types. I managed to prove this today by testing notify_ scripts on different vm. It worked with standard policy but not with VMware policy type, but we would like to have WMware vmdk backups for easier restore. 

      NetBackup does not recommend backup without quiescing as they cannot guaranty consistency of the backup image.

  • Hello.

    first of all, as I remember you can not create a VM snapshot if you share disks. What type of cluster you have?

    I think that you have three (actually two) solutions to implement vm backup of the passive node. These are my thoughts. There are not full solution and you have to check them and find how to implement one of them.

    • use VMware rest api to put a tag to the inactive node and create a VIP policy with filter to backup the VM with the right tag.
      you can create a script on the client to change the tag every time the cluster service change node. I think that this is the most robust solution
    • you can create a standard policy without backup window at the schedules and add manually the two VMs,  and create a script on both nodes that will run with crontab.
      The script will check if this is the inactive node and will run a manual backup of the correct VM.
      You can start the manual backup using netbackup rest api or by running the following command on the client (you have to add the client to the servers list of the master server)
      bpbackup -i -p <policy> -s <schedule> -h <client_name>
    • if the clients and the master server are linux systems you can trust each other and create the txt to the master server. Then you can have a script on the master server to start your backup. This is not the way I like as if someone penetrate to one of the systems will have access to the others.
    • nerminator's avatar
      nerminator
      Level 3

      Hi,

      * Tagging VMs and creating VIP will involve work on another layer (VMwere layer). I don't think it is possible to create a tag from within the OS of the virtual machine. Correct me if I am wrong please?

      * Is it possible to have Crontab activating jobs on VMware policy or does it has to be standard policy type? (NetBackup client is installed and configured on both nodes)

      * " Then you can have a script on the master server to start your backup" . Do you mean bpstart_notify script?

      Thank you for the already provided help. 

      • davidmoline's avatar
        davidmoline
        Level 6

        Hi nerminator 

        Firstly, it is possible to run a pre backup script for a VMware backup using the VMware pre/post snapshot scripts. Have a look at this article https://www.veritas.com/support/en_US/article.100009553 - it does refer to BackupExec, but the process is outside Veritas, so will also work with NetBackup. That said, I'm not sure this could be leveraged to help, but you could try playing around with the process. 

        Secondly, you could create a "dummy" backup that runs on the master server and backs up effectively nothing, but does run a bpstart_notify script that then determines which VM is the passive node and executes a backup of that VM - so the start script runs some logic and then calls a further backup of the correct node.

        Cheers
        David