cancel
Showing results for 
Search instead for 
Did you mean: 

Backup of passive node with script

nerminator
Level 2

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.

1 ACCEPTED SOLUTION

Accepted Solutions

StefanosM
Level 6
Partner    VIP    Accredited Certified

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.

View solution in original post

7 REPLIES 7

Michal_Mikulik1
Moderator
Moderator
Partner    VIP    Accredited Certified

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.

StefanosM
Level 6
Partner    VIP    Accredited Certified

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.

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.

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. 

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

Hi, @davidmoline 

Could you please explain in more detail how would second option work, with steps if possible? One that does "dummy" backup on the Master server. I don't understand how to start\link the backup policy to the the correct client, if master server is in the backup policy. Thanks

Hi @nerminator 

So you need at least two policies.

One will be run on the master (or another host with the client installed). This policy (let's call this vm-app-starter) will be a file system policy that has a very small backup selection (I suggest using the name of the bpstart_notify script you will also create). The client will be the host it runs on (e.g. the master), and the schedules should what you want to run for the VMware server (makes things simpler this way. Also on the master (or other host) you will need to create a bpstart_notify.vp-app-starter script. This script will need to determine which VM host is the passive node (I leave this to you) - set this name to a variable in the script, say client. The script will look something like the below sample, the key item is to run the command "bpbackup -p vm-app-passive -s $schedule -h $client -i". The variables client is determined by your logic and schedule is passed from the vm-app-starter schedule as argument 3 when the script is called. The "-i" option will start the backup but not wait for it to complete.

The second policy will be the VMware policy (let's call this vm-app-passive) which can be used to backup the passive node. The clients in this script will be the two nodes from the cluster. The scehdules need to exist (use the same names as the first poilcy) but DO NOT open any window on these (you will always be running this policy manually - via the script - you do not want this policy to start via the schduler). 

Here is the outline for the script. If your master is Windows, you will need to adjust paths and logic accordingly.

#/bin/sh
# script to run backup of VM passive node for app cluster.
# This script:
# receives 4 parameters: CLIENTNAME POLICYNAME SCHEDNAME SCHEDTYPE
# must be executable by the root user
# should exit with 0 upon successful completion

# Logic to determine passive node.
# Logic sets variable client
....
client= #TBD

# The schedule to run will be determined by the wrapper policy and directly passed to the real backup
schedname = $3

/usr/openv/netbackup/bin/bpbackup -p vm-app-passive -s $schedname -h $client -i

 What you will see in the backup monitor is the first policy will start and finish very quickly (you may need to adjust the BPSTART_TIMEOUT value if the logic takes time - the default value is 300 seconds). Either just after or just before the first policy complets, you should see the second policy start - this will take as long as it needs to. 

Cheers
David