Performing Pre-Freeze and Post-Thaw Processing Using Nutanix Guest Tools

You can use Nutanix guest tools (NGT) to perform specific operations before or after a backup. For example, if a virtual machine hosts an Oracle database and you want to enable the hot backup of the database before performing the backup, you can run a script using NGT.

If a virtual machine hosts a VSS-aware application such as Microsoft SQL Server, Microsoft Exchange, or Oracle, enable the File System and Application Consistent option for a VM group or subclient to provide the ability to back up the database and perform an image level application-consistent database recovery.

Scripts for Linux VMs

You can use scripts to take a snapshot of a VM with an application. These scripts enable Nutanix AHV to suspend I/O updates until the Linux guest snapshot is completed.

On Linux virtual machines, the /usr/local/sbin/pre_freeze script runs when the software snapshot is created and the /usr/local/sbin/post_thaw script runs when the software snapshot is finalized. These scripts must have root ownership and root access with 700 permissions.

The following sample scripts are available to perform pre-freeze or post-thaw processing using NGT tools. You might need to modify these scripts to meet the requirements of your environment.

Note

Scripts will not run if they include control characters. If control characters appear in a script, the characters will not allow the shell to identify the interpreter. Check the script using a program such as dos2unix. The dos2unix program converts plain text files in DOS/MAC format to UNIX format.

  • Oracle scripts:

  • MySQL scripts:

  • File system scripts:

  • PostgreSQL scripts

    • pre_freeze (PostgreSQL)

    • post_thaw (PostgreSQL)

    • quiesce.py (edit to include the PostgreSQL port, database user credentials, and the name of a database on the PostgreSQL server, other than the template0 database)

    • unquiesce.py (edit to include the PostgreSQL port, database user credentials, and the name of a database on the PostgreSQL server, other than the template0 database)

      Note

      The database user specified for the quiesce.py and unquiesce.py scripts must be a superuser on the PostgreSQL server.

Before You Begin

  • To quiesce and unquiesce MySQL databases using Python scripts, Python and MySQL-Python modules must be installed on the guest VM where MySQL runs.

  • To quiesce and unquiesce a file system, the file system must support freezing. File systems that support freezing include Btrfs, ext2, ext3, ext4, F2FS, JFS, NILFS2, ReiserFS, or XFS).

  • To quiesce and unquiesce PostgreSQL databases using Python scripts, Python and Psycopg2 modules must be installed on the guest VM where PostgreSQL runs.

Procedure

  1. Copy the scripts for the application to the Linux virtual machine:

    • Oracle:

      1. On a Linux , copy the Oracle pre_freeze and post_thaw scripts to the /usr/local/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 Agent installed on it, you can also use the consistent-archivelog-backup.rman script as a sample to run archivelog backup. This script takes a consistent snap, gets all the latest archived logs, and gets the current control file.

    • MySQL:

      1. Copy the MySQL pre_freeze and post_thaw scripts to the /usr/local/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).

    • File System:

      1. Copy the File System pre_freeze and post_thaw scripts to the /usr/local/sbin directory.
    • PostgreSQL:

      1. Copy the PostgreSQL pre_freeze and post_thaw scripts to the /usr/local/sbin directory.

      2. Copy the quiesce.py and unquiesce.py scripts to a location where the PostgreSQL database can execute them (preferably to the /usr/sbin directory).

  2. Run a backup of the virtual machine.

For more information about running scripts on Windows virtual machines, see the Nutanix article PRE_FREEZE AND POST_THAW SCRIPT GUIDELINES.

Loading...