Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 18 Next »

Product Version: 9.0
Last Modified: 06 Sep 2019

Background

In the Application-aware mode, NAKIVO Backup & Replication triggers custom scripts you provide, prior to making snapshots of LVM volumes.

If you run a VM with Linux or FreeBSD guest OS under Hyper-V, refer Hyper-V support article about supported Linux and FreeBSD versions.

Solution

To make application-aware mode working on Linux guest OS, you need to put custom scripts called pre-freeze-script and post-thaw-script into /usr/sbin directory and give them executive permissions. When the backup job starts running, NAKIVO Backup & Replication triggers these scripts prior to making snapshots of LVM volumes.

pre-freeze-script and post-thaw-script scripts require root permissions to be executed.

When a non-root user is used, scripts invocation will be done via sudo, therefore the following requirements must be met.

1. Provided credentials must have full access without a password in /etc/sudoers 

#User privilege specification
root ALL=(ALL:ALL) ALL
#Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
#Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
#See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
nakivo ALL=(ALL) NOPASSWD:ALL

2. If NAKIVO Backup & Replication logs into Amazon EC2 instance and there's no password for Linux user, provided credentials must have a password to execute sudo:

    1. Log into the instance via SSH client using pem key
    2. Execute sudo passwd ubuntu
    3. Open /etc/sudoers in a text editor
    4. Add ubuntu ALL=(ALL) NOPASSWD:ALL to the bottom of the file
    5. Open /etc/ssh/sshd_config in a text editor
    6. Add set up PasswordAuthentication yes
    7. Reboot the instance
    8. Log into the instance via SSH client without pem key, enter password

Scripts Examples

You can use VMware tools to perform specific operations before or after a backup. For example, if a virtual machine hosts an Oracle database and you want to quiesce the database before performing a backup, you can run a script using VMware tools. On Linux virtual machines, the script /usr/sbin/pre-freeze-script is executed when the software snapshot is created and /usr/sbin/post-thaw-script is executed when the software snapshot is finalized.

The following scripts are available to perform pre- or post-processing using VMware tools:

Operation

Procedure

Scripts

DB2

Scripts can be used to take a snapshot of a VM with the DB2 application. These scripts enable VMware to suspend I/O updates to the DB2 database until the VMware Linux guest snapshot is completed.

  1. On a Linux virtual machine, copy the pre-freeze-script and post-thaw-script to the /usr/sbin directory.
  2. Copy the write_suspend and write_resume scripts to a location where the DB2 database can execute them (preferably to a directory under DB2 home).
 pre-freeze-script

#!/bin/sh

if [ "$(id -u)" -eq "0" ]; then
exec su - db2inst2 -c /db2home/db2inst2/write_suspend
fi


 post-thaw-script

#!/bin/sh

if [ "$(id -u)" -eq "0" ]; then
exec su - db2inst2 -c /db2home/db2inst2/write_resume
fi

 write_resume.sh

#!/bin/sh

export INSTHOME=/db2home/db2inst2

date >> $INSTHOME/write_resume.log
echo "----START RESUME----" >> $INSTHOME/write_resume.log << EOF
EOF

$INSTHOME/sqllib/bin/db2 connect to test >> $INSTHOME/write_resume.log
echo "+++" >> $INSTHOME/write_resume.log << EOF_1
EOF_1

$INSTHOME/sqllib/bin/db2 set write resume for database >> $INSTHOME/write_resume.log
echo "+++" >> $INSTHOME/write_resume.log << EOF_2
EOF_2

echo "----END----" >> $INSTHOME/write_resume.log << EOF_3
EOF_3

 write_suspend.sh

#!/bin/sh

export INSTHOME=/db2home/db2inst2

date >> $INSTHOME/write_suspend.log
echo "----START SUSPEND----" >> $INSTHOME/write_suspend.log << EOF
EOF

#connect to the database
$INSTHOME/sqllib/bin/db2 connect to test >> $INSTHOME/write_suspend.log
echo "+++" >> $INSTHOME/write_suspend.log << EOF_1
EOF_1

#set write condition for database
$INSTHOME/sqllib/bin/db2 set write suspend for database >> $INSTHOME/write_suspend.log
echo "+++" >> $INSTHOME/write_suspend.log << EOF_2
EOF_2

echo "----END----" >> $INSTHOME/write_suspend.log << EOF_3
EOF_3

MAXDB

Scripts can be used to take a snapshot of a VM with the MAXDB application. These scripts enable VMware to suspend I/O updates to the MAXDB database until the VMware Linux guest snapshot is completed.

  1. On a Linux virtual machine, copy the pre-freeze-script and post-thaw-script to the /usr/sbin directory.
  2. Copy suspend_logwriter and resume_logwriter scripts to a location where MAXDB database can execute them (preferably to a directory under MAXDB home).
 pre-freeze-script

#!/bin/sh

if [ "$(id -u)" -eq "0" ]; then
exec su - sdb -c /home/sdb/suspend_logwriter
fi

 post-thaw-script

#!/bin/sh

if [ "$(id -u)" -eq "0" ]; then
exec su - sdb -c /home/sdb/resume_logwriter
fi

 resume_logwriter.sh

#!/bin/sh

export INSTHOME=/home/sdb

date >> $INSTHOME/resume_logwriter.log
echo "----START RESUME----" >> $INSTHOME/resume_logwriter.log << EOF
EOF

#set resume logwriter for database
dbmcli -d MaxDB -u DBADMIN,DBADMIN util_execute resume logwriter >> $INSTHOME/resume_logwriter.log
echo "resume done" >> $INSTHOME/resume_logwriter.log << EOF_1
EOF_1


dbmcli -d MaxDB -u DBADMIN,DBADMIN util_release >> $INSTHOME/resume_logwriter.log
echo "release done" >> $INSTHOME/resume_logwriter.log << EOF_2
EOF_2

echo "----END----" >> $INSTHOME/resume_logwriter.log << EOF_3
EOF_3

 suspend_logwriter.sh

#!/bin/sh

export INSTHOME=/home/sdb

date >> $INSTHOME/suspend_logwriter.log
echo "----START SUSPEND----" >> $INSTHOME/suspend_logwriter.log << EOF
EOF

#connect to the database
dbmcli -d MaxDB -u DBADMIN,DBADMIN util_connect DBADMIN,DBADMIN >> $INSTHOME/suspend_logwriter.log
echo "util_connect done" >> $INSTHOME/suspend_logwriter.log << EOF_1
EOF_1

#set suspend logwriter for database
dbmcli -d MaxDB -u DBADMIN,DBADMIN util_execute suspend logwriter >> $INSTHOME/suspend_logwriter.log
echo "suspend logwriter done" >> $INSTHOME/suspend_logwriter.log << EOF_2
EOF_2

echo "----END----" >> $INSTHOME/suspend_logwriter.log << EOF_3
EOF_3

Oracle

Scripts can be used to take a snapshot of a VM with the Oracle application. These scripts enable VMware to suspend I/O updates to the Oracle database until the VMware Linux guest snapshot is completed.

  1. On a Linux virtual machine, copy the pre-freeze-script and post-thaw-script to the /usr/sbin directory.
  2. Copy the pre-freeze-script.sql and post-thaw-script.sql scripts to a location where the Oracle database can execute them (preferably to a directory under Oracle home).

These scripts change the entire database to backup mode.

If the virtual machine has the Oracle iDataAgent installed on it, you can also use the consistent-archivelog-backup.rman script as a sample to run archivelog backup. This script gets a consistent snapshot, all the latest archived logs, and the current control file.

pre-freeze-script

post-thaw-script

pre-freeze-script.sql

post-thaw-script.sql

consistent-archivelog-backup.rman

Sybase

Scripts can be used to take a snapshot of a VM with the Sybase application. These scripts enable VMware to suspend I/O updates to the Sybase database until the VMware Linux guest snapshot is completed.

  1. On a Linux virtual machine, copy the pre-freeze-script and post-thaw-script to the /usr/sbin directory.
  2. Copy pre-freeze-script.sql and post-thaw-script.sql scripts to a location where the Sybase database can execute them (preferably to a directory under Sybase home).

    These scripts execute Sybase quiesce commands that stop updates to the databases.

pre-freeze-script

post-thaw-script

pre-freeze-script.sql

post-thaw-script.sql

MySQL

Scripts can be used to take a snapshot of a VM with the MySQL application. These scripts enable VMware to suspend I/O updates to the MySQL database until the VMware Linux guest snapshot is completed.

  1. On a Linux virtual machine, copy the pre-freeze-script and post-thaw-script to the /usr/sbin directory.
  2. Copy the quiesce.py and unquiesce.py scripts to a location where the MySQL database can execute them (preferably to the /usr/sbin directory).

A Python script is used to quiesce and unquiesce the databases. Python and MySQL-Python modules must be installed on the client computer.

pre-freeze-script

post-thaw-script

unquiesce.py

quiesce.py

  • No labels