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.
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.
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
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.
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.
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.
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).
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.
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.
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.
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.
tsm: ZMANDA>define domain zrm_mysql
ANR1500I Policy domain ZRM_MYSQL defined.
tsm: ZMANDA>define policyset zrm_mysql standard
ANR1510I Policy set STANDARD defined in policy domain ZRM_MYSQL.
tsm: ZMANDA>define mgmt zrm_mysql standard 30days
ANR1520I Management class 30DAYS defined in policy domain ZRM_MYSQL, set STANDARD.
tsm:ZMANDA>define volume backuppool /home/tsm_backup/bf.dsm formatsize=10000
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.
tsm: ZMANDA>assign defmgmt zrm_mysql standard 30days
ANR1538I Default management class set to 30DAYS for policy domain ZRM_MYSQL, set STANDARD.
tsm: ZMANDA>validate policyset zrm_mysql standard
ANR1515I Policy set STANDARD validated in domain ZRM_MYSQL (ready for activation).
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
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.
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
tsm: ZMANDA>define association zrm_mysql test_zrm zmanda
ANR2510I Node ZMANDA associated with schedule TEST_ZRM in policy domain ZRM_MYSQL.
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:
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.
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
SE filesystem
# ln -s /opt/tivoli/tsm/client/ba/bin/dsm.sys /opt/tivoli/tsm/client/api/bin/dsm.sys
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
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.
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.
All these commands must be performed as super user
# dsmc q b /var/lib/mysql-zrm/"*" -su=yes
# dsmc rest /var/lib/mysql-zrm/"*" /home/mysql/ -su=yes
# dsmc rest /var/lib/mysql-zrm/amanda_db/20091118014234/"*" -su=yes
# 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.
All commands in the section must be performed as super user.
# dsmc q b /var/lib/mysql-zrm/"*" -su=yes
# 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