This MindTouch Deki has expired; please contact your system administrator. Visit MindTouch.com for activation information.
Project:Zmanda Recovery Manager for MySQL 3.5 > Zmanda Recovery Manager Backups for IBM Tivoli Storage Manager (TSM)

Zmanda Recovery Manager Backups for IBM Tivoli Storage Manager (TSM)

Zmanda Recovery Manager (ZRM) for MySQL can be used with IBM Tivoli Storage Manager (TSM). ZRM provides various backup and recovery methods for MySQL database and applications. Tivoli Storage Manager provides media manager for ZRM backups. TSM can be used along with ZRM to do backup MySQL to tapes and also to consolidate all your backup of applications.

Zmanda Recovery Manager is configured using Zmanda Management Console (ZMC). Please see Zmanda Management Console documentation for pre-requisites, installation and configuration of MySQL backups.  All ZRM backup methods are supported with TSM option.

Requirements


Following are list of requirements on the ZRM server that performs MySQL backups and acts as TSM client. You can use TSM server machine as the ZRM server also.

  • Zmanda Recovery Manager (ZRM) for MySQL server running Linux RHEL/CentOS/SLES distribution. The Linux distribution must be supported by IBM TSM 6.1 Linux client.
  • IBM Tivoli Storage Manager V6.1, Linux Clients, Multilingual (CZ1NIML)
  • Zmanda Recovery Manager/TSM option
  • sudo privileges to execute ''dsmc'' (TSM client) command as ''mysql'' user is required.
  • Sufficient disk space to store MySQL backups before they are sent to media managed by TSM.

Installation

This chapter does not cover installation of Zmanda Recovery Manager for MySQL server and IBM Tivoli Storage Manager Linux Client. For ZRM server software installation, please take a look at ZRM manuals. Please refer to IBM manuals for TSM client requirements and installation.

This chapter also assumes TSM server has been installed and configured according to TSM manuals.

ZRM/TSM option is an rpm package that can be downloaded from Zmanda Network Downloads page. ZRM server software should be installed before ZRM/TSM option installation. Use rpm command to install TSM option (For example):


# rpm -ivh MySQL-zrm-enterprise-tsm-3.8-1.noarch.rpm

ZRM/TSM Backup Configuration

There are two ways to configure ZRM and TSM so that backups and recovery of MySQL databases can be performed using various ZRM backup methods. 

  1. ZRM post backup plugin to call TSM client command to initiate backup of ZRM backup location. The ZRM scheduler is used to schedule backups. This method is recommended.
  2. TSM scheduler calling ZRM backup commands directly. TSM scheduler determines when the backups are performed.

In both methods, the MySQL backup configuration is performed using ZRM Zmanda Management Console and the media configuration should be done as part of TSM configuration. These methods described in detail in next two sections.

Using ZRM Post Backup Plugin

ZRM keeps all backed up data at /var/lib/mysql-zrm directory (default value) on the ZRM server. This location can be changed using ZRM Zmanda Management Console in the '''Backup Where''' page. TSM will backup the ZRM backup destination directory.

IBM Tivoli server configuration

Configure ZRM server as a node to the TSM server with proper domain, backupset  and backuppool configuration. This will define backup policies and where the backups will be stored in the media on the TSM server. See Using TSM Scheduler section for an example TSM server configuration (first few steps in the example).

ZRM server/TSM client configuration

Use Zmanda Management Console to create backup sets and backup policies. You will have to specify what to backup, when to backup, where to backup and how to backup.

In ZMC Backup How page, specify the post backup plugin as /usr/share/mysql-zrm/plugins/mysql-zrm-post-backup-tsm.pl as shown below.

Post-Backup-Plugin-TSM.jpg

Before performing backup, TSM ''dsmc'' command must be added ''sudoers'' file on the ZRM server. ZRM performs all operations as ''mysql'' user. TSM client command cannot be run as ''mysql'' user. So sudo configuration is needed.

The ZRM configuration file ''mysql-zrm.conf'' under ''/etc/mysql-zrm/<backup set name/'' must be edited to add the following parameters. These parameters are not added by ZRM. ''tsm-client-binary-path'' is location where TSM client commands are installed on ZRM server. ''destination'' is location where ZRM backup images are stored. This parameter can be configured in ZMC Backup Where page. ''tsm-server'' is the name of TSM server (configured as NODE). ''tsm-password'' is the password of tsmadmin user on the TSM server.

For example:

tsm-client-binary-path="/opt/tivoli/tsm/client/ba/bin"
destination="/var/lib/mysql-zrm"
tsm-server="zmanda"
tsm-password="tsmadmin123"

You can schedule, monitor and look at backup reports using Zmanda Management Console. Execution of post-backup plugin can be seen in the ZMC monitor page.

Please note that all backup images from all backup sets in the ZRM server are moved to TSM.

Using TSM scheduler

In this method, ZRM MySQL backup job is configured to run using TSM scheduler. Configuration is required on both TSM server, ZRM server and TSM client. Please note that TSM client and ZRM server must be the same machine. TSM server can also run on the same machine or different machine.

TSM configuration

Using TSM storage administrator, TSM server should have new domain, policy set, and management class configured. Following steps show an example configuration of ZRM backup job on the TSM server from the ZRM server using commands.

  • Login as root to the TSM server ''zmanda'' and connect to TSM as ''tsmadmin'' user.
    dsmadmc -server=Zmanda -id=tsmadmin -password=tsmadmin123
  • Define a domain “zrm_mysql”:

tsm: ZMANDA>define domain zrm_mysql
ANR1500I Policy domain ZRM_MYSQL defined.

  • Define “policyset” “standard” for domain “zrm_mysql”

 tsm: ZMANDA>define policyset zrm_mysql standard
 ANR1510I Policy set STANDARD defined in policy domain ZRM_MYSQL.

  • Define management class for domain “zrm_mysql” with standard and with retention policy of 30 days.

 tsm: ZMANDA>define mgmt zrm_mysql standard 30days
 ANR1520I Management class 30DAYS defined in policy domain ZRM_MYSQL, set STANDARD.

  • Create  “backuppool” storage group with  is volumes (DISK or sequential file). Following command creates vdisk /home/tsm_backup/bf.dsm of size 10GB for storage pool “backuppool”

 tsm:ZMANDA>define volume backuppool /home/tsm_backup/bf.dsm formatsize=10000

  • Define “COPYGROUP” with destination backup-pool as “backuppool”.

 tsm: ZMANDA>def co zrm_mysql standard 30days dest=backuppool verd=nol vere=nol reto=30 rete=30
 ANR1530I Backup copy group STANDARD defined in policy domain ZRM_MYSQL, set STANDARD, management class 30DAYS.

  • Assign management class to the domain “zrm_mysql”.

 tsm: ZMANDA>assign defmgmt zrm_mysql standard 30days
 ANR1538I Default management class set to 30DAYS for policy domain ZRM_MYSQL, set STANDARD.

  • Validate policyset.

 tsm: ZMANDA>validate policyset zrm_mysql standard
 ANR1515I Policy set STANDARD validated in domain ZRM_MYSQL (ready for activation).

  • Activate policy set.

 tsm: ZMANDA>activate policyset zrm_mysql standard
 Do you wish to proceed? (Yes (Y)/No (N)) y
 ANR1514I Policy set STANDARD activated in policy domain ZRM_MYSQL.

  • Query the domain for the confirmation from the ZRM server

 dsmadmc -server=Zmanda -id=tsmadmin -password=tsmadmin123 query domain

 ANS8000I Server command: 'query domain'
 Policy             Activated      Activated      Number of     Description
 Domain          Policy            Default         Registered
 Name             Set                Mgmt               Nodes
                                           Class
 ---------             ---------        ---------           ----------     ------------------------
 STANDARD      STANDARD      STANDARD             0          Installed default policy domain.
 ZRM_MYSQL    STANDARD      30DAYS                 0

  • Connect to the TSM server using ''dsmadmc'' command. Register the node “zmanda” with domain “zrm_mysql” and password as “tsmadmin123”. This registers the node with TSM server and creates user same as node name with specified password.

Note: Password specified during node registration should be used along with “dsmc” command.

 tsm: ZMANDA>register node zmanda tsmadmin123 domain=zrm_mysql
 ANR2060I Node ZMANDA registered in policy domain ZRM_MYSQL.
 ANR2099I Administrative userid ZMANDA defined for OWNER access to node ZMANDA.

  • Define a backup schedule to execute ZRM backup job.

tsm: ZMANDA>def sched zrm_mysql test_zrm  type=client action=command objects="/usr/share/mysql-zrm/plugins/mysql-zrm-tsm-job.sh" startt=21:00 startd=today dur=2 pri=1 scheds=classic day=any exp=never

  • Associate schedule to Policy domain “zrm_mysql” and node “zmanda”

 tsm: ZMANDA>define association zrm_mysql test_zrm zmanda
 ANR2510I Node ZMANDA associated with schedule TEST_ZRM in policy domain ZRM_MYSQL.

  • Query the schedule to verify the scheduler configuration

 dsmadmc -server=zmanda -id=tsmadmin -password=tsmadmin123 query schedule format=detailed

 ANS8000I Server command: 'query schedule format=detailed'
            Policy Domain Name: ZRM_MYSQL
                 Schedule Name: TEST_ZRM
                   Description: To test first schedule
                        Action: Command
                       Options:
                       Objects: /usr/share/mysql-zrm/plugins/mysql-zrm-tsm-job.sh
                      Priority: 5
               Start Date/Time: 11/12/2009 01:15:00
                      Duration: Indefinite
                Schedule Style: Classic
                        Period: One Time
                   Day of Week: Any
                         Month:
                  Day of Month:
                 Week of Month:
                    Expiration:
 Last Update by (administrator): TSMADMIN
         Last Update Date/Time: 1/12/2010 00:46:21
              Managing profile:

ZRM configuration

In this method, ZRM backup set must be configured in Zmanda Management Console. The backup set configuration involves what to backup, where to backup to and how to backup. All backup methods can be used.

The backup set should be called TSM_Backup. To use alternate names for the backup set, change the ZRM_BACKUP_SET value in /usr/share/mysql-zrm/plugins/mysql-zrm-tsm-job.sh file.

TSM will back up entire filesystem of TSM client including the ZRM backup directory. By default ZRM backup directory is /var/lib/mysql-zrm.

TSM Client configuration
  • Create /opt/tivoli/tsm/client/ba/bin/dsm.sys as shown in the example. This configuration defines how TSM client communicates with TSM server.


 SErvername  zmanda
   COMMMethod         TCPip
   TCPPort            1500
   TCPServeraddress   172.21.2.129

 SE filesystem
 TCPSERVERADDRESS 172.21.2.129
 SCHEDLOGNAME /var/log/mysql-zrm-tsm-filesystem-dsmsched.log
 ERRORLOGNAME /var/log/mysql-zrm-tsm-filesystem-dsmsched.log
 PASSWORDACCESS generate


 SE zrm_mysql
 TCPSERVERADDRESS 172.21.2.129
 SCHEDLOGNAME /var/log/mysql-zrm-tsm-dsmsched.log
 ERRORLOGNAME /var/log/mysql-zrm-tsm-dsmsched.log
 PASSWORDACCESS generate
 NODENAME zmanda

  • Create /opt/tivoli/tsm/client/ba/bin/dsm.opt with following contents

SE filesystem

  • Create a symbolic link for TSM client configuration.

# ln -s /opt/tivoli/tsm/client/ba/bin/dsm.sys /opt/tivoli/tsm/client/api/bin/dsm.sys

  • Test the TSM client connection to TSM server. Password for “ZMANDA” node  was provided during registration of NODE.


 dsmc -se=zrm_mysql
 tsm> query node

 Please enter your user id <ZMANDA>:
 Please enter password for user id "ZMANDA":

  Session established with server ZMANDA: Linux/x86_64
  Server Version 6, Release 1, Level 2.0
  Server date/time: 11/11/2009 03:54:12  Last access: 11/11/2009 03:54:01

    Node Name   Platform   Policy Domain   Days Since   Days Since   Locked?
                           Name            Last Access  Password Set
    _________   _________  _____________   __________   ____________ _______
       ZMANDA     Linux86   ZRM_MYSQL           0           0           0

TSM scheduler configuration

After ZRM server, TSM server and TSM client configuration,

Start the TSM scheduler (the command below) on the TSM server. You can run the scheduler from ''xinetd'' scripts.

 dsmc sched -password=tsmadmin123 >> /var/log/tsm_scheduler_service.log 2>&1 &

/var/log/tsm_scheduler_service.log will contain output messages from dsmc TSM command.

MySQL Database recovery

The MySQL database restoration and recovery process is the same for both configuration methods – ZRM post backup plugin and Using TSM scheduler.  The recovery is a two step process – Recovery of ZRM images from Tivoli Storage Manager media and then recovery of MySQL database from the ZRM backup images.

Restoring MySQL database from an alternate location when TSM restore has been performed to the alternate location

All these commands must be performed as super user

  • Query a backup which needs to be restored.

# dsmc q b /var/lib/mysql-zrm/"*" -su=yes

  • Restore backup from TSM to directory other than original backup directory.  Following command will restore TSM backup of  “/var/lib/mysql-zrm/" to alternate directory at “/home/mysql/”

# dsmc rest /var/lib/mysql-zrm/"*" /home/mysql/ -su=yes

  • To restore a specific backup image (mysql_db backed up on 18 Nov 2009) to alternate location “/home/mysql/” on the ZRM server

# dsmc rest /var/lib/mysql-zrm/amanda_db/20091118014234/"*" -su=yes

  • After completion of TSM restoration,  ZRM commands can be used to restore MySQL database.  Following command will restore all databases from the backup set ''mysql_db'' to the original MySQL database server.

# mysql-zrm-restore --backup-set mysql_db --source-directory /home/mysql/mysql-zrm/mysql_db/20091118014234

For certain kinds of backup (such as ZRM raw backup), MySQL server will have to be restarted.

Restoring MySQL from original ZRM backup location

All commands in the section must be performed as super user.

  • Query the TSM backup which needs to be restored.

# dsmc q b /var/lib/mysql-zrm/"*" -su=yes

  • Restore backup from TSM to original directory.  Following command will restore TSM backup of /var/lib/mysql-zrm/ selective directory to its original location.

# dsmc rest /var/lib/mysql-zrm/"*" -su=yes


If directories are already present at original location the TSM will ask file conflict resolution question for each file.
Select an appropriate action
  1. Replace this object
  2. Replace all objects that already exist
  3. Skip this object
  4. Skip all objects that already exist
  A. Abort this operation

  • After TSM successful restoration, ZRM is ready to restore MySQL database. Following command will restore all the databases specified in “mysql_db” backup set. Zmanda Management Console can also be used for perform the restoration.
    $ mysql-zrm-restore --backup-set mysql_db --source-directory /var/lib/mysql-zrm/mysql_db/20091118014234

 

Powered by MindTouch Deki v.8.08.2