Vcs Mysql Install
Vcs Mysql Install
Vcs Mysql Install
5.1
March 2012
Veritas High Availability Agent for MySQL Installation and Configuration Guide
The software described in this book is furnished under a license agreement and may be used only in accordance with the terms of the agreement. Agent Version: 5.1.2.0 Document version: 5.1.2.0.0
Legal Notice
Copyright 2012 Symantec Corporation. All rights reserved. Symantec, the Symantec logo, Veritas, Veritas Storage Foundation, CommandCentral, NetBackup, Enterprise Vault, and LiveUpdate are trademarks or registered trademarks of Symantec corporation or its affiliates in the U.S. and other countries. Other names may be trademarks of their respective owners. The product described in this document is distributed under licenses restricting its use, copying, distribution, and decompilation/reverse engineering. No part of this document may be reproduced in any form by any means without prior written authorization of Symantec Corporation and its licensors, if any. THE DOCUMENTATION IS PROVIDED "AS IS" AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID. SYMANTEC CORPORATION SHALL NOT BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES IN CONNECTION WITH THE FURNISHING, PERFORMANCE, OR USE OF THIS DOCUMENTATION. THE INFORMATION CONTAINED IN THIS DOCUMENTATION IS SUBJECT TO CHANGE WITHOUT NOTICE. The Licensed Software and Documentation are deemed to be commercial computer software as defined in FAR 12.212 and subject to restricted rights as defined in FAR Section 52.227-19 "Commercial Computer Software - Restricted Rights" and DFARS 227.7202, "Rights in Commercial Computer Software or Commercial Computer Software Documentation", as applicable, and any successor regulations. Any use, modification, reproduction release, performance, display or disclosure of the Licensed Software and Documentation by the U.S. Government shall be solely in accordance with the terms of this Agreement.
Technical Support
Symantec Technical Support maintains support centers globally. Technical Supports primary role is to respond to specific queries about product features and functionality. The Technical Support group also creates content for our online Knowledge Base. The Technical Support group works collaboratively with the other functional areas within Symantec to answer your questions in a timely fashion. For example, the Technical Support group works with Product Engineering and Symantec Security Response to provide alerting services and virus definition updates. Symantecs support offerings include the following:
A range of support options that give you the flexibility to select the right amount of service for any size organization Telephone and/or Web-based support that provides rapid response and up-to-the-minute information Upgrade assurance that delivers software upgrades Global support purchased on a regional business hours or 24 hours a day, 7 days a week basis Premium service offerings that include Account Management Services
For information about Symantecs support offerings, you can visit our Web site at the following URL: www.symantec.com/business/support/index.jsp All support services will be delivered in accordance with your support agreement and the then-current enterprise technical support policy.
Hardware information Available memory, disk space, and NIC information Operating system Version and patch level Network topology Router, gateway, and IP address information Problem description:
Error messages and log files Troubleshooting that was performed before contacting Symantec Recent software configuration changes and network changes
Customer service
Customer service information is available at the following URL: www.symantec.com/business/support/ Customer Service is available to assist with non-technical questions, such as the following types of issues:
Questions regarding product licensing or serialization Product registration updates, such as address or name changes General product information (features, language availability, local dealers) Latest information about product updates and upgrades Information about upgrade assurance and support contracts Information about the Symantec Buying Programs Advice about Symantec's technical support options Nontechnical presales questions Issues that are related to CD-ROMs or manuals
Documentation
Product guides are available on the media in PDF format. Make sure that you are using the current version of the documentation. The document version appears on page 2 of each guide. The latest product documentation is available on the Symantec Web site. https://sort.symantec.com/documents Your feedback on product documentation is important to us. Send suggestions for improvements and reports on errors or omissions. Include the title and document version (located on the second page), and chapter and section titles of the text on which you are reporting. Send feedback to: [email protected]
Contents
Technical Support ............................................................................................... 4 Chapter 1 Introducing the Veritas High Availability Agent for MySQL ............................................................................. 11
About the Veritas agent for MySQL ................................................. Whats new in this agent ............................................................... Features of the Veritas Agent for MySQL .......................................... Supported software ...................................................................... Support matrix for IMF and in-depth monitoring ......................... How the agent makes MySQL highly available ................................... MySQL agent functions ................................................................. Online .................................................................................. Offline ................................................................................. Monitor ................................................................................ Clean ................................................................................... Setting up MySQL in a VCS cluster .................................................. 11 12 12 13 13 14 14 15 15 15 17 17
Chapter 2
19 19 19 20 20 20 20 21 21 22 22 23
Contents
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Contents
Chapter 7
Appendix A
Sample Configurations
...................................................... 59 59 59 62 65
About sample configurations for the agent for MySQL ........................ Sample agent type definition type for MySQL .................................... Sample configuration files ............................................................. Sample service group configurations for MySQL ................................
Index
.................................................................................................................... 69
10
Contents
Chapter
About the Veritas agent for MySQL Whats new in this agent Features of the Veritas Agent for MySQL Supported software How the agent makes MySQL highly available MySQL agent functions Setting up MySQL in a VCS cluster
12
Introducing the Veritas High Availability Agent for MySQL Whats new in this agent
understanding of the MySQL applications architecture and the administration tasks required to start, stop, monitor, and operate these components. See the following Technical Support TechNote for the latest updates or software issues for this agent: http://www.symantec.com/business/support/index?page=content&id=TECH46455
Added Intelligent Monitoring Framework (IMF) capability and support for intelligent resource monitoring. The SecondLevelMonitor attribute of the Veritas agent for MySQL is deprecated if both the following software versions are installed:
Veritas Cluster Server (VCS) 5.1 SP1 or later Veritas agent for MySQL version 5.1.2.0
In such a case, instead of the SecondLevelMonitor attribute, you must use the resource type level attributeLevelTwoMonitorFreqto specify the frequency of in-depth monitoring. For more information: See MySQL agent attributes on page 33.
Enables the validation of attributes based on entry points. Validates the attributes in each entry point, before the actual data processing starts. Hence, the code is robust. First Failure Data Capture (FFDC) In case of a fault, the agent generates a huge volume of debug logs that enable troubleshooting of the fault. Fast First Level Monitor (FFLM) Maintains PID files based on search patterns to expedite the monitoring process. Supports external user-supplied monitor utilities In addition to the built-in monitoring logic, user-specified monitor utilities can be plugged-in. This enables the administrator to customize the monitoring of the application. Delay entry point
Introducing the Veritas High Availability Agent for MySQL Supported software
13
The agent intelligently delays the first monitor after online for slow initializing applications.
Supported software
The Veritas agent for MySQL supports the following software versions in a VCS environment:
Veritas Cluster Server
AIXVCS 4.0, 5.0, 5.1, 6.0 HP-UXVCS 4.1, 5.0, 5.1, 6.0 LinuxVCS 4.0, 4.1, 5.0, 5.1, 6.0 SolarisVCS 4.0, 4.1, 5.0, 5.1, 6.0
AIX 5.1, 5.2, 5.3, 6.1 on pSeries HP-UX 11i v2, 11i v3 on Itanium and PA-RISC
Red Hat Enterprise Linux (RHEL) 3, 4, 5 on Intel and ppc64 RHEL 6.0 on Intel SUSE Linux Enterprise Server 9, 10, 11 on Intel and ppc64 Solaris 8, 9, 10 on SPARC including the zones
Solaris 10 x64
5.2.2.0 and later 5.0, 5.1, 5.5 and all intermediate minor versions of these releases.
14
Introducing the Veritas High Availability Agent for MySQL How the agent makes MySQL highly available
IMF capability
Yes
VCS 5.1 SP1 with No MySQL agent 5.1.1.0 or earlier VCS 5.1 or earlier with MySQL agent 5.1.2.0 or later VCS 5.1 or earlier with MySQL agent 5.1.1.0 or earlier No
Yes
No
Yes
No
No
Yes
No
Primary or Basic monitoring This mode has Process check and Health check monitoring options. With the default Process check option, the agent verifies that the MySQL instance processes are present in the process table. Process check cannot detect whether processes are in hung or stopped states. Secondary or Detail monitoring In this mode, the agent runs a utility to verify the status of MySQL instance. The agent detects application failure if the monitoring routine reports an improper function of the MySQL instance processes. When this application failure occurs, the MySQL instance service group fails over to another node in the cluster. Thus, the agent ensures high availability for MySQL instance.
Introducing the Veritas High Availability Agent for MySQL MySQL agent functions
15
Online
The online function performs the following tasks:
Verifies that the required attributes are set correctly. Verifies that the MySQL Server instance is not already online. If the instance is online, the online operation exits immediately If any MySQL processes remain, the operation kills these processes using the user name associated with the specific resource. Attempts to start the MySQL server instance with the command:
$ BaseDir/bin/mysqld_safe --defaults-file=MyCnf \ --datadir=DataDir --user=MySQLUser
The command always gets executed in the context of MySQLUser, specifying the MySQL configuration file, if specified by the MyCnf agent attribute.
Checks if the server has started up completely. Gives the control back to HAD.
Offline
The offline function performs the following tasks:
Verifies that the required attributes are set correctly. Verifies that the MySQL Server instance is not offline. If the instance is already offline, the operation verifies if any processes belonging to this MySQL resource, exist. Attempts to stop the MySQL server instance with the command:
$ BaseDir/bin/mysqladmin --user=MySQLAdmin \ --password=MySQLAdminPasswd shutdown
The command always gets executed in the context of MySQLUser. Then the offline operation kills any existing processes that belong to this MySQL server instance. Gives the control back to HAD.
Monitor
The monitor function monitors the states of the MySQL Servers on all nodes within the cluster. The operation performs the following tasks:
The monitor function conducts a first level check to determine that the MySQL Server processes, are running on the system in the cluster. If the first level
16
Introducing the Veritas High Availability Agent for MySQL MySQL agent functions
check does not find these processes running on the node, the check exits immediately, and reports the instance as OFFLINE. The agent also supports Intelligent Monitoring Framework (IMF) in the first level check. IMF enables intelligent resource monitoring. The agent for MySQL is IMF-aware and uses the asynchronous monitoring framework (AMF) kernel driver for resource state change notifications. See How the agent supports intelligent resource monitoring on page 40. You can use the MonitorFreq key of the IMF attribute to specify the frequency at which the agent invokes the monitor function. See MonitorFreq on page 42. Note: The agent sets the cluster MySQL type level attribute, ToleranceLimit to 1. This ensures that the application gets an opportunity to restart a failed mysqld instance, before the agent flags the instance OFFLINE, to initiate a failover. If the SecondLevelMonitor attribute is set to greater than 0, the monitor operation conducts a second level check. The agent uses a connect(3c) method on the IP address specified by the HostName agent attribute to check for the MySQL server to listen to the port defined by the Port attribute. The agent then uses the monitor command to verify that the MySQL server is really up.
$ BaseDir/bin/mysqladmin --user=MySQLAdmin \ --password=MySQLAdminPasswd status
Depending upon the MonitorProgram attribute, the monitor operation can perform a customized check using a user-supplied monitoring utility. Please refer to the agent attributes for more details regarding this attribute. the section called MySQL agent attributes Note: The attribute used to configure the second level check and its frequency depends on the software versions of VCS and MySQL agent you have installed: For VCS 5.1 SP1 or later with MySQL agent version 5.1.2.0, use the LevelTwoMonitorFreq attribute. For VCS 5.1 or earlier with MySQL agent 5.1.1.0 or earlier, use the SecondLevelMonitor attribute.
Introducing the Veritas High Availability Agent for MySQL Setting up MySQL in a VCS cluster
17
Clean
In case of a failure or after an unsuccessful attempt to online or offline a MySQL Server instance, the clean operation performs the following tasks:
Attempts to gracefully shut down the MySQL server instance with the command:
$ BaseDir/bin/mysqladmin --user=MySQLAdmin \ --password=MySQLAdminPasswd shutdown
The clean operation kills any remaining process pertaining to this MySQL instance. Gives the control back to HAD.
Note: For information about the additional functions of the agent for MySQL when IMF is enabled: See Agent functions for the IMF functionality on page 41.
Set up a VCS cluster. Install and configure MySQL for High Availability. Install the Veritas High Availability agent for MySQL. See Installing the agent in a VCS environment on page 27. Configure the service groups for MySQL. See About configuring service groups for MySQL on page 51.
18
Introducing the Veritas High Availability Agent for MySQL Setting up MySQL in a VCS cluster
Chapter
About MySQL Installing the MySQL instance Setting MySQL parameters after installation Adding a dedicated database administrator with shutdown privileges only Virtualizing MySQL
About MySQL
MySQL is a relational database management system (RDBMS). The MySQL software delivers a very fast, multi-threaded, multi-user, and robust SQL (Structured Query Language) database server. MySQL Server is intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software.
20
Installing and configuring MySQL for high availability Setting MySQL parameters after installation
See Configuring the MySQL base directory and database directory on page 20. See Configuring virtual IP addresses on page 20. See Configuring Ports on page 21. See Configuring the MySQL database user on page 21.
Installing and configuring MySQL for high availability Setting MySQL parameters after installation
21
unique IP address on all failover nodes of the cluster for specifying the HostName agent attribute. Also ensure that this is specified in the database configuration file (my.cnf) via the bind-address configuration parameter. An IP address should be used as its value as a workaround for a bug in some versions of MySQL as reported by: http://bugs.mysql.com/bug.php?id=28516 Review the information on the HostName agent attribute. See MySQL agent attributes on page 33.
Configuring Ports
To ensure that multiple instances can be hosted on the same failover node, the HostName/Port pair combination has to be unique. MySQL server by default listens on port 3306. This can be changed using the port configuration parameter.
22
Installing and configuring MySQL for high availability Adding a dedicated database administrator with shutdown privileges only
This assumes that the session owner has grant access to add a database user and assign privileges for database shutdown to that user. Ensure that you can shutdown the database instance using this database user:
$ BaseDir/bin/mysqladmin -user=MySQLAdmin --password=XXXXXX shutdown
Where MySQLAdmin is the database administrator being created and registered with the agent, and XXXXXX is the password being set for this administrator, which is encrypted and specified using the MySQLAdminPasswd agent attribute. For information on MySQLAdmin and MySQLAdminPasswd attributes, review the Agent attributes section. See MySQL agent attributes on page 33.
Virtualizing MySQL
To ensure that your MySQL machine can function properly on any node of the cluster, you need to virtualize all the parameters that could be dependent on a particular node.
23
Path names
Where,
socket The value of the socket database parameter under the [mysqld] section of the configuration file The value of the port database parameter under the [mysqld] section of the configuration file
port
For an excerpt of a typical MySQL configuration file: See Configuring the MySQL database user on page 21. Hence, for the current example, the sample environment file will be:
MYSQL_UNIX_PORT MYSQL_TCP_PORT = /tmp/mysql.sock; export MYSQL_UNIX_PORT = 3306; export MYSQL_TCP_PORT
Note: This procedure is also valid when multiple instances are not being hosted.
24
Chapter
Before you install the Veritas agent for MySQL About the ACC library Installing the ACC library Installing the agent in a VCS environment Removing the agent in a VCS environment Removing the ACC library
Install and configure Veritas Cluster Server. For more information on installing and configuring Veritas Cluster Server, refer to the Veritas Cluster Server Installation Guide. Install the latest version of ACC Library.
26
Installing, upgrading, and removing the agent for MySQL About the ACC library
To install or update the ACC Library package, locate the library and related documentation in the Agent Pack tarball: See Installing the ACC library on page 26.
1 2
Log in as superuser. Download ACC Library. You can download either the complete Agent Pack tarball or the individual ACCLib tarball from the Symantec Operations Readiness Tools (SORT) site (https://sort.symantec.com/agents).
If you downloaded the complete Agent Pack tarball, navigate to the directory containing the package for the platform running in your environment.
AIX HP-UX Linux Solaris cd1/aix/vcs/application/acc_library/version_library/pkgs cd1/hpux/generic/vcs/application/acc_library/version_library/pkgs cd1/linux/generic/vcs/application/acc_library/version_library/rpms cd1/solaris/dist_arch/vcs/application/acc_library/version_library/pkgs where dist_arch is sol_sparc or sol_x64.
Installing, upgrading, and removing the agent for MySQL Installing the agent in a VCS environment
27
4 5
If you downloaded the individual ACCLib tarball, navigate to the pkgs directory (for AIX, HP-UX, and Solaris), or rpms directory (for Linux). Install the package. Enter Yes if asked to confirm overwriting of files in the existing package.
AIX HP-UX Linux # installp -ac -d VRTSacclib.bff VRTSacclib # swinstall -s pwd VRTSacclib # rpm -i \ VRTSacclib-VersionNumber-GA_GENERIC.noarch.rpm # pkgadd -d VRTSacclib.pkg
Solaris
Download the agent from the Symantec Operations Readiness Tools (SORT) site: https://sort.symantec.com/agents. You can download either the complete Agent Pack tar file or an individual agent tar file.
2 3
Uncompress the file to a temporary location, say /tmp. If you downloaded the complete Agent Pack tar file, navigate to the directory containing the package for the platform running in your environment.
AIX cd1/aix/vcs/database/mysql_agent/ vcs_version/version_agent/pkgs cd1/hpux/generic/vcs/database/mysql_agent/ vcs_version/version_agent/pkgs cd1/linux/generic/vcs/database/mysql_agent/ vcs_version/version_agent/rpms cd1/solaris/dist_arch/vcs/database/mysql_agent/ vcs_version/version_agent/pkgs where, dist_arch is sol_x64 or sol_sparc
HP-UX
Linux
Solaris
If you downloaded the individual agent tar file, navigate to the pkgs directory (for AIX, HP-UX, and Solaris), or rpms directory (for Linux).
28
Installing, upgrading, and removing the agent for MySQL Removing the agent in a VCS environment
4 5
Solaris
# pkgadd -d . VRTSmysql
After installing the agent package, you must import the agent type configuration file. See Importing the agent types files in a VCS environment on page 31.
1 2
Log in as a superuser. Set the cluster configuration mode to read/write by typing the following command from any node in the cluster:
# haconf -makerw
Remove all MySQL resources from the cluster. Use the following command to verify that all resources have been removed:
# hares -list Type=MySQL
Remove the agent type from the cluster configuration by typing the following command from any node in the cluster:
# hatype -delete MySQL
Removing the agents type file from the cluster removes the include statement for the agent from the main.cf file, but the agent's type file is not removed from the cluster configuration directory. You can remove the agents type file later from the cluster configuration directory.
Installing, upgrading, and removing the agent for MySQL Removing the ACC library
29
Save these changes. Then set the cluster configuration mode to read-only by typing the following command from any node in the cluster:
# haconf -dump -makero
Use the platform's native software management program to remove the agent for MySQL from each node in the cluster. Execute the following command to uninstall the agent:
AIX HP-UX Linux Solaris # installp -u VRTSmysql.rte # swremove VRTSmysql # rpm -e VRTSmysql # pkgrm VRTSmysql
1 2
Ensure that all agents that use ACC library are removed. Run the following command to remove the ACC library package.
AIX HP-UX Linux Solaris # installp -u VRTSacclib # swremove VRTSacclib # rpm -e VRTSacclib # pkgrm VRTSacclib
30
Installing, upgrading, and removing the agent for MySQL Removing the ACC library
Chapter
About configuring the Veritas agent for MySQL Importing the agent types files in a VCS environment MySQL agent attributes Executing a customized monitoring program
32
Configuring the agent for MySQL Importing the agent types files in a VCS environment
To import the agent types file using the VCS graphical user interface
1 2 3
Start the Veritas Cluster Manager and connect to the cluster on which the agent is installed. Click File > Import Types. In the Import Types dialog box, select the following file:
VCS 5.x
/etc/VRTSagents/ha/conf/MySQL/ MySQLTypes.cf
VCS 5.0
Solaris SPARC /etc/VRTSagents/ha/conf/MySQL/ and x64 MySQLTypes50.cf Solaris SPARC /etc/VRTSagents/ha/conf/MySQL/ and x64 MySQLTypes51.cf
VCS 5.1
4 5
Click Import. Save the VCS configuration. You can now create MySQL resources. For additional information about using the VCS GUI, refer to the Veritas Cluster Server Administrator's Guide.
To import the agent types file using the Veritas Cluster Server command line interface (CLI):
1 2
Log on to any one of the systems in the cluster as the superuser. Create a temporary directory.
# mkdir ./temp # cd ./temp
/etc/VRTSvcs/conf/sample_MySQL/ MySQLTypes.cf
VCS 5.x
/etc/VRTSagents/ha/conf/MySQL/ MySQLTypes.cf
33
VCS 5.0
/etc/VRTSagents/ha/conf/MySQL/ MySQLTypes50.cf
The MySQL agent type is now imported to the VCS engine. You can now create MySQL resources. For additional information about using the VCS CLI, refer to the Veritas Cluster Server Administrator's Guide.
ERROR: Only logs error messages. WARN: Logs above plus warning messages. INFO: Logs above plus informational messages TRACE: Logs above plus trace messages. TRACE is very verbose and should be used only during initial configuration or for troubleshooting and diagnostic operations.
34
MySQLAdminPasswd
Password for the database administrator specified in the MySQLAdmin attribute. The password is encrypted using the VCS encrypt utility, vcsencrypt(1m).
Note: You need not encrypt the password if you are using the
VCS GUI to enter the password. VCS GUI automatically encrypts the password. Default Value: "" Example : jxmXkvVvkVnvWvsVx MySQLUser The dedicated OS login created while installing the MySQL server. The database server will be started as this user. This login has to be identical on all failover nodes. Default Value: mysql Example: mysql DataDir The absolute path to the directory storing the database being managed by this instance of the server. Symantec recommends storing this directory on shared storage so that the same copy is available on the failover node. The database directory should be owned by the user specified by the MySQLUser agent attribute. Default Value: "" Example: /db/bbmas/data
35
Table 4-2 lists the optional attributes for the MySQL agent. Table 4-2 Attribute
EnvFile
HostName
Virtual host name for this MySQL Database instance. The monitor agent function uses this attribute to determine if the server is responding to client requests. This attribute is required only if second level monitoring is enabled. Default Value: "" Example: mysql.veritas.com
Port
Represents the port number dedicated to the MySQL server. The monitor agent function uses this value to determine if the server responds to client requests. This attribute is required only if second level monitoring is enabled. Default Value: 3306 Example: 3306
36
SecondLevelMonitor
Used to enable second-level monitoring and specify how often it is run. Second-level monitoring is a deeper, more thorough state check of the configured MySQL instance. The numeric value specifies how often that the second-level monitoring routines are run. Care should be taken when setting this attribute to large numbers. For example, if the MonitorInterval is set to 60 seconds, and the SecondLevelMonitor is set to 100, then the second level check would only get performed every 100 minutes, which may not be as often as intended. To provide maximum flexibility, the value set is not checked for an upper limit. You can set the second level check to occur once a month, if that is desired.
37
LevelTwoMonitorFreq
Note: This attribute is applicable to VCS version 5.1 SP1 or later with MySQL agent version 5.1.2.0 or later. If the VCS version is earlier than VCS 5.1 SP1 and the MySQL agent version is earlier than 5.1.2.0, use the SecondLevelMonitor attribute.
If you upgraded the VCS version to VCS 5.1 SP1 or later and the MySQL agent version to 5.1.2.0 (or later), and if you had enabled detail monitoring in the previous version, then do the following:
Set the value of the LevelTwoMonitorFreq attribute to the same value as that of the SecondLevelMonitor attribute.
The MonitorProgram attribute value is set to a valid executable utility. The first-level process check indicates that the MySQL server instance is online. The SecondLevelMonitor attribute is set to 1 and the second-level check returns the server state as ONLINE. Or The SecondLevelMonitor attribute is set to greater than 1, but the second-level check is deferred for this monitoring cycle.
38
To ensure that the custom monitor utility is always available to the agent application, Symantec recommends storing the file in the directory in which the MySQL server gets installed.
Chapter
About Intelligent Monitoring Framework How the agent supports intelligent resource monitoring Agent functions for the IMF functionality Attributes that enable IMF Before you enable the agent for IMF Enabling the agent for IMF Disabling intelligent resource monitoring Troubleshooting the configuration for IMF Sample IMF configurations Known issues
40
Enabling the agent for MySQL for IMF How the agent supports intelligent resource monitoring
VCS process and mount-based agents use the Asynchronous Monitoring Framework (AMF) kernel driver that provides asynchronous event notifications to the agents that are enabled for Intelligent Monitoring Framework (IMF). You can enable the MySQL agent for IMF, provided the following software versions are installed:
Veritas Cluster Server (VCS) 5.1 SP1 or later Veritas High Availability agent for MySQL version Agent Version: 5.1.2.0 or later
See the Veritas Cluster Server Administrators Guide 5.1 Service Pack 1 for more information about:
Benefits of IMF
IMF offers the following benefits:
Performance Enhances performance by reducing the monitoring of each resource at a default of 60 seconds for online resources, and 300 seconds for offline resources. IMF enables the agent to monitor a large number of resources with a minimal effect on performance. Faster detection Asynchronous notifications would detect a change in the resource state as soon as it happens. Immediate notification enables the agent to take action at the time of the event.
Enabling the agent for MySQL for IMF Agent functions for the IMF functionality
41
the state of that resource. The agent notifies the state change to VCS, which then takes appropriate action. See the Veritas Cluster Server Administrators Guide 5.1 Service Pack 1 for more information.
imf_init
This function initializes the MySQL agent to interface with the AMF kernel driver, which is the IMF notification module for the agent for MySQL. This function runs when the agent starts up.
imf_getnotification
This function gets notifications about resource state changes. This function runs after the agent initializes with the AMF kernel module. This function continuously waits for notification and takes action on the resource upon notification.
imf_register
This function registers or unregisters resource entities with the AMF kernel module. This function runs for each resource after the resource goes into a steady stateonline or offline.
IMF
This resource type-level attribute determines whether the MySQL agent must perform intelligent resource monitoring. You can also override the value of this attribute at the resource level. This attribute includes the following keys:
42
Enabling the agent for MySQL for IMF Attributes that enable IMF
Mode
Define this attribute to enable or disable intelligent resource monitoring. Valid values are as follows:
0Does not perform intelligent resource monitoring 1Performs intelligent resource monitoring for offline resources and performs poll-based monitoring for online resources 2Performs intelligent resource monitoring for online resources and performs poll-based monitoring for offline resources 3Performs intelligent resource monitoring for both online and for offline resources.
Note: The agent for MySQL supports intelligent resource monitoring for online resources only. Hence, Mode should be set to either 0 or 2. Type and dimension: integer-association Default: 0
MonitorFreq
This key value specifies the frequency at which the agent invokes the monitor agent function. The value of this key is an integer. Default: 1 You can set this key to a non-zero value for cases where the agent requires to perform both poll-based and intelligent resource monitoring. If the value is 0, the agent does not perform poll-based process check monitoring. After the resource registers with the AMF kernel driver, the agent calls the monitor agent function as follows:
After every (MonitorFreq x MonitorInterval) number of seconds for online resources After every (MonitorFreq x OfflineMonitorInterval) number of seconds for offline resources
RegisterRetryLimit
If you enable intelligent resource monitoring, the agent invokes the imf_register agent function to register the resource with the AMF kernel driver.
Enabling the agent for MySQL for IMF Before you enable the agent for IMF
43
The value of the RegisterRetryLimit key determines the number of times the agent must retry registration for a resource. If the agent cannot register the resource within the limit that is specified, then intelligent monitoring is disabled until the resource state changes or the value of the Mode key changes. Default: 3.
IMFRegList
An ordered list of attributes whose values are registered with the IMF notification module. Type and dimension: string-vector Default: No default value Note: The attribute values can be overriden at the resource level.
AgentFile: Set the AgentFile attribute to Script51Agent IMF Mode: Set the IMF Mode attribute to 2 IMFRegList: Update the IMFRegList attribute
The following sections provide more information on the commands you can use to make these configuration changes, depending on whether VCS is in a running state or not.
44
Enabling the agent for MySQL for IMF Enabling the agent for IMF
Note: If you have upgraded VCS from an earlier version to version 5.1 SP1 or later, and you already have MySQL agent version installed, ensure that you run the following commands to create appropriate symbolic links:
# cd /opt/VRTSagents/ha/bin/MySQL # ln -s /opt/VRTSamf/imf/imf_getnotification imf_getnotification # ln -s /opt/VRTSagents/ha/bin/MySQL/monitor imf_register
For VCS version 6.0 or later, run the following commands to add the IMF attributes:
# haattr -add -static ResourceType IMF -integer -assoc Mode 0 MonitorFreq 1 RegisterRetryLimit 3 # haattr -add -static ResourceType IMFRegList -string vector
Note: Execute these commands only once after you first enable IMF support for the agent.
For example, to enable intelligent monitoring of online resources, with the MonitorFreq key set to 5, and the RegisterRetryLimit key is set to 3, run the following command:
# hatype -modify MySQL IMF Mode 2 MonitorFreq 5 RegisterRetryLimit 3
Note: The valid values for the Mode key of the IMF attribute are 0 (disabled) and 2 (online monitoring).
Enabling the agent for MySQL for IMF Enabling the agent for IMF
45
If the MySQL agent is running, restart the agent. For information on the commands you can use to restart the agent, see Restarting the agent.
Note: Stopping the agent forcefully eliminates the need to take the resource offline.
46
Enabling the agent for MySQL for IMF Disabling intelligent resource monitoring
Update the IMF attribute. The valid values for the Mode key of the IMF attribute are 0 (disabled) and 2 (online monitoring).
static int IMF{} = { Mode=num, MonitorFreq=num, RegisterRetryLimit=num }
For example, to update the IMF attribute such that the Mode key is set to 2, the MonitorFreq key is set to 5, and the RegisterRetryLimit key is set to 3:
static int IMF{} = { Mode=2, MonitorFreq=5, RegisterRetryLimit=3 }
To disable intelligent resource monitoring for all the resources of a certain type, run the following command:
# hatype -modify MySQL IMF -update Mode 0
To disable intelligent resource monitoring for a specific resource, run the following command:
# hares -override resource_name IMF # hares -modify resource_name IMF -update Mode 0
Enabling the agent for MySQL for IMF Troubleshooting the configuration for IMF
47
Ensure that the following attributes are configured with appropriate values.
AgentFile IMF IMFRegList If IMFRegList is not configured correctly, the MySQL resources that have been registered for IMF get unregistered every time the monitor function is run.
If you have configured the required attributes to enable the MySQL agent for IMF, but the agent is still not IMF-enabled, restart the agent. The imf_init function runs only when the agent starts up, so when you restart the agent, imf_init runs and initializes the MySQL agent to interface with the AMF kernel driver. You can run the following command to check the value of the MonitorMethod attribute and to verify that a resource is registered for IMF.
# hares -value resource MonitorMethod system
The MonitorMethod attribute specifies the monitoring method that the agent uses to monitor the resource:
You can use the amfstat to see a list of registered PIDs for a MySQL resource. A sample output of the ps ef command for the MySQL processes is as follows:
$/usr/ucb/ps auxwwl | grep mysql 0 551 1646 1 0 59 20 1688 1304 6001cb5b198 S ? 0:00 sh -c /opt/mysql/mysql/bin/mysqld_safe --datadir=/var/lib/mysql --user=mysql 0 551 1648 1646 0 59 20 1744 1360 6001caec108 S ? 0:00 /bin/sh /opt/mysql/mysql/bin/mysqld_safe --datadir=/var/lib/mysql --user=mysql 0 551 1695 1648 0 59 206660834160 6001c997682 S ? 0:00 /opt/mysql/mysql/bin/mysqld --basedir=/opt/mysql/mysql --datadir=/var/lib/mysql --user=mysql --log-error=/var/lib/mysql/vcssx074.vxindia. veritas.com.err --pid-file= /var/lib/mysql/vcssx074. vxindia.veritas.com.pid 0 0 1747 550 0 49 20 1640
48
Enabling the agent for MySQL for IMF Sample IMF configurations
MySQL
Run the following command to set the ResLogLevel attribute to TRACE. When you set ResLogLevel to TRACE, the agent logs messages in the MySQL_A.log file.
# hares -modify ResourceName ResLogLevel TRACE
Run the following command to view the content of the AMF in-memory trace buffer.
# amfconfig p dbglog
See Troubleshooting the agent for MySQL on page 55. For information about asynchronous monitoring, attributes that enable asynchronous monitoring, and instructions on using some AMF CLI: Veritas Cluster Server Administrator's Guide 5.1 Service Pack 1 Veritas Cluster Server Release Notes 5.1 Service Pack 1
Enabling the agent for MySQL for IMF Sample IMF configurations
49
type MySQL ( static int ToleranceLimit = 1 static boolean AEPTimeout = 1 static str AgentFile = "/opt/VRTSvcs/bin/Script50Agent" static str AgentDirectory = "/opt/VRTSagents/ha/bin/MySQL" static str ArgList[] = { ResLogLevel, State, IState, MySQLUser, MySQLAdmin, MySQLAdminPasswd, EnvFile, BaseDir, DataDir, MyCnf, HostName, Port, SecondLevelMonitor, MonitorProgram } str ResLogLevel = INFO str MySQLUser = mysql str MySQLAdmin = root str MySQLAdminPasswd str EnvFile str BaseDir str DataDir str MyCnf str HostName int Port = 3306 int SecondLevelMonitor = 0 str MonitorProgram static int IMF{} = { Mode=2, MonitorFreq=5, RegisterRetryLimit=3 } static str IMFRegList[] = { BaseDir DataDir MySQLUser } )
50
Known issues
This release of the agent for MySQL has the following known issue: Problem An error message might appear when you run the hares -offline command to take a resource offline. Description When a resource is taken offline, it is unregistered from the AMF module. However, the imf_register function attempts to unregister the resource again. This results in an error message from the engine log. Workaround It is safe to ignore this error message.
Chapter
About configuring service groups for MySQL Before configuring the service groups for MySQL MySQL entities in a clustered environment Configuring MySQL resources for Solaris zones support
The Cluster Manager (Java console) Veritas Operations Manager The command-line
Verify that VCS is installed and configured on all nodes in the cluster where you will configure the service group. Refer to the Veritas Cluster Server Installation Guide for more information.
52
Configuring the service groups for MySQL MySQL entities in a clustered environment
Verify that the Veritas agent for MySQL is installed on all nodes in the cluster. See Installing the agent in a VCS environment on page 27.
Install MySQL on dedicated Solaris zones. Preferably, follow the Symantec recommendation of installing zones on a shared disk for convenient configuration, failover, and maintenance.
Configuring the service groups for MySQL Configuring MySQL resources for Solaris zones support
53
Make sure that the name of the Solaris zone is the same as the virtual host name that you use to install and configure the MySQL. In a VCS environment, ensure that you have set the value of ContainerName attribute to the name of the Solaris zone. By default the agent function executes in the Global zone.
54
Configuring the service groups for MySQL Configuring MySQL resources for Solaris zones support
Chapter
Using the correct software and operating system versions Meeting prerequisites Verifying virtualization Starting the MySQL server outside cluster Reviewing error log files
Meeting prerequisites
Before installing the agent for MySQL, double check that you meet the prerequisites. For example, you must install the ACC library on VCS before installing the agent for MySQL. See Before you install the Veritas agent for MySQL on page 25.
56
Verifying virtualization
Verify that your application does not use anything that ties it down to a particular node of the cluster. See Virtualizing MySQL on page 22.
Starting the MySQL server To start the MySQL server outside cluster, execute:
$ BaseDir/bin/mysqld_safe --defaults-file=MyCnf \ --datadir=DataDir --user=MySQLUser &
Stopping the MySQL server To stop the MySQL server outside cluster, execute:
$ BaseDir/bin/mysqladmin --user=MySQLAdmin \ --password=MySQLAdminPasswd shutdown
Monitoring the MySQL server First verify that the MySQL processes are running as MySQLUser The agent uses a connect(3c) method to check for the MySQL server to listen to the port defined by the Port attribute. Try doing
$ telnet HostName Port
The agent then uses the following monitor command to verify that the MySQL server is up.
$ BaseDir/bin/mysqladmin --user=MySQLAdmin --password=XXXXXX status Uptime: 2221700 Threads: 1 Questions: 35 Slow queries: 0 Opens: 28 Flush tables: 1 Open tables: 4 Queries per second avg: 0.000
57
$ echo $? 0
where XXXXXX is the password for the MySQLAdmin database user. The command is executed in the context of the MySQLUser. Try executing this command manually to verify if the MySQL server is up.
58
Appendix
Sample Configurations
This appendix includes the following topics:
About sample configurations for the agent for MySQL Sample agent type definition type for MySQL Sample configuration files Sample service group configurations for MySQL
60
int ToleranceLimit = 1 boolean AEPTimeout = 1 str AgentFile = "/opt/VRTSvcs/bin/Script50Agent" str AgentDirectory = "/opt/VRTSagents/ha/bin/MySQL"
61
static str ArgList[] = { ResLogLevel, State, IState, MySQLUser,MySQLAdmin, MySQLAdminPasswd, EnvFile, BaseDir, DataDir, MyCnf, HostName, Port, SecondLevelMonitor, MonitorProgram } str ResLogLevel = INFO str MySQLUser = mysql str MySQLAdmin = root str MySQLAdminPasswd str EnvFile str BaseDir str DataDir str MyCnf str HostName int Port = 3306 int SecondLevelMonitor = 0 str MonitorProgram )
62
63
) Volume RES_Volume ( Volume = mysql_vol DiskGroup = mysqldb ) RES_Ip requires RES_Nic RES_Mount requires RES_Volume RES_MySQL requires RES_Ip RES_MySQL requires RES_Mount RES_Volume requires RES_DiskGroup // // // // // // // // // // // // // // // // // // // resource dependency tree group SG_MySQL { MySQL RES_MySQL { Mount RES_Mount { Volume RES_Volume { DiskGroup RES_DiskGroup } } IP RES_Ip { NIC RES_Nic } } }
64
system Node2 ( ) group SGz_MySQL ( SystemList = { Node1 = 0, Node2 = 1 } Administrators = { z_RESz_Zone_Node2, z_RESz_Zone_Node1 } ) DiskGroup RESz_Dg ( DiskGroup = mysql ) Mount RESz_Mount ( MountPoint = "/zones/mysql/" BlockDevice = "/dev/vx/dsk/mysql/mysql_vol_zone" FSType = vxfs FsckOpt = "-y" ) MySQL RESz_MySQL ( ResLogLevel = TRACE MySQLAdmin = mysql MySQLAdminPasswd = iwoUlwL BaseDir = "/opt/mysql/mysql/" DataDir = "/var/lib/mysql/" MyCnf = "/etc/my.cnf" HostName = mysql SecondLevelMonitor = 1 ContainerName = mysql ) NIC RESz_NIC ( Device = bge0 ) Volume RESz_Vol ( Volume = mysql_vol_zone DiskGroup = mysql ) Zone RESz_Zone ( ZoneName = mysql ) RESz_Mount requires RESz_Vol RESz_MySQL requires RESz_Zone RESz_Vol requires RESz_Dg RESz_Zone requires RESz_Mount RESz_Zone requires RESz_NIC // resource dependency tree
65
// // // // // // // // // // // // // // // // // //
group SGz_MySQL { MySQL RESz_MySQL { Zone RESz_Zone { Mount RESz_Mount { Volume RESz_Vol { DiskGroup RESz_Dg } } NIC RESz_NIC } } }
66
Figure A-1
Figure A-2 shows a sample service group with Solaris zone support.
67
Figure A-2
RESz_Zone Zone
NIC RESz_NIC
DiskGroup RESz_DiskGroup
68
Index
A
about configuring service groups 51 about ACC library 26 ACC library installing 26 removing 29 agent attributes 33 clean function 17 configuration 62 features 12 importing agent types files 31 installing, VCS environment 27 monitor function 15 offline function 15 online function 15 overview 11 service group configuration 65 supported software 13 type definition 59 uninstalling, VCS environment 28 whats new 12 agent configuration file importing 31 agent functions imf_getnotification 41 imf_init 41 imf_register 41 agent installation general requirements 25 steps to install 27
E
executing custom monitor program 37
I
installing MySQL 19 Intelligent Monitoring Framework (IMF) about 39 agent functions 41 attributes 41 benefits 40 configuring 43 troubleshooting 47
L
logs reviewing error log files 57 using MySQL logs 58
M
MySQL about 19 configuring resources for Solaris zones 52 entities 52 installing 19 virtualization 22 Host names 23 Path names 23 MySQL entities, clustered environment 52
R
removing agent, VCS environment 28
B
before configuring the service groups 51
S
setting MySQL in a cluster 17 Solaris zone support configuring MySQLresources 52 supported software 13
C
configuring monitor function 37
70
Index
T
troubleshooting meeting prerequisites 55 reviewing error log files 57 using MySQL log files 58 using correct software 55 verifying virtualization 56
U
uninstalling agent, VCS environment 28