Table 1–1 lists the tasks for installing and configuring Sun Cluster HA for MySQL. Perform these tasks in the order that they are listed.
Table 1–1 Task Map: Installing and Configuring Sun Cluster HA for MySQL
Task |
For Instructions, Go To |
---|---|
Plan the installation |
Sun Cluster HA for MySQL Overview Planning the Sun Cluster HA for MySQL Installation and Configuration |
Install and configure MySQL | |
Verify installation and configuration | |
Install Sun Cluster HA for MySQL Packages |
How to Install the Sun Cluster HA for MySQL Packages by Using the scsintall Utility |
Register and Configure Sun Cluster HA for MySQL |
How to Register and Configure Sun Cluster HA for MySQL as a Failover Service |
Verify Sun Cluster HA for MySQL Installation and Configuration |
How to Verify the Sun Cluster HA for MySQL Installation and Configuration |
Understand Sun Cluster HA for MySQL fault monitor | |
Debug Sun Cluster HA for MySQL | |
Upgrade to SC3.1 when using Sun Cluster HA for MySQL | |
Upgrade to MySQL 4.0.12 from 3.23.54 when using Sun Cluster HA for MySQL |
Upgrade to MySQL 4.0.12 from 3.23.54 when using Sun Cluster HA for MySQL |
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.MySQL is a trademark of MySQL ABTM.
MySQL is freely available under the GNU General Public License and can be downloaded from http://www.mysql.com.
The Sun Cluster HA for MySQL data service provides a mechanism for orderly startup and shutdown, fault monitoring and automatic failover of the MySQL service. The following MySQL components are protected by the Sun Cluster HA for MySQL data service.
Table 1–2 Protection of Components
Component |
Protected by |
---|---|
MySQL server |
Sun Cluster HA for MySQL |
This section contains the information you need to plan your Sun Cluster HA for MySQL installation and configuration.
Your data service configuration might not be supported if you do not observe these restrictions.
Consider the restrictions in this section to plan the installation and configuration of Sun Cluster HA for MySQL. This section provides a list of software and hardware configuration restrictions that apply to Sun Cluster HA for MySQL only.
For restrictions that apply to all data services, see the Sun Cluster Release Notes.
The Sun Cluster for MySQL can only be configured as a HA and not a Scalable.
The MySQL configuration file (my.cnf) should only be placed in the MySQL Database directory. If my.cnf has to be placed in local filesystem then create a symlink from the MySQL Database directory. No my.cnf should be in /etc (Global file) because it could override command line options
Supported configurations – Currently, only the following configurations are supported with the Sun Cluster HA for MySQL data service.
Single/Multiple MySQL instances in master configuration
Single/Multiple MySQL instances in slave configuration
The master and slave instances shouldn't be on the same physical node.
Installing MySQL onto Cluster File Systems — Regardless of which MySQL delivery method you have chosen, ie from http://www.mysql.com or from other source, the following restrictions apply.
Each MySQL instance must have a unique Database directory. This Database directory can be mounted as either a Failover File System or Global File System.
It is considered best practice when mounting Global File Systems to mount them with the /global prefix and to mount Failover File Systems with the /local prefix. However, be aware that this is simply viewed as best practice.
The following example shows MySQL installed onto a Global File System with two MySQL instances (mysql-data-1and mysql-data-2) . The final output shows a subset of the /etc/vfstab entries for MySQL deployed using Veritas Volume Manager.
# ls -l /usr/local total 4 drwxrwxrwx 2 root other 512 Oct 1 16:44 bin lrwxrwxrwx 1 root other 13 Oct 11 11:20 mysql -> /global/mysql # # ls -l /global/mysql total 10432 drwxr-xr-x 13 mysql mysql 512 Mar 16 00:03 . drwxrwxrwx 7 root other 2048 Apr 11 09:53 .. -rw-r--r-- 1 mysql mysql 19106 Mar 15 23:29 COPYING -rw-r--r-- 1 mysql mysql 28003 Mar 15 23:29 COPYING.LIB -rw-r--r-- 1 mysql mysql 126466 Mar 15 16:47 ChangeLog -rw-r--r-- 1 mysql mysql 6811 Mar 15 23:29 INSTALL-BINARY -rw-r--r-- 1 mysql mysql 1937 Mar 15 16:47 README drwxr-xr-x 2 mysql mysql 1536 Mar 16 00:03 bin -rwxr-xr-x 1 mysql mysql 773 Mar 16 00:03 configure drwxr-x--- 4 mysql mysql 512 Mar 16 00:03 data drwxr-xr-x 2 mysql mysql 1024 Mar 16 00:03 include drwxr-xr-x 2 mysql mysql 512 Mar 16 00:03 lib drwxr-xr-x 3 mysql mysql 512 Mar 16 00:03 man -rw-r--r-- 1 mysql mysql 2676944 Mar 15 23:23 manual.html -rw-r--r-- 1 mysql mysql 2329252 Mar 15 23:23 manual.txt -rw-r--r-- 1 mysql mysql 98233 Mar 15 23:23 manual_toc.html drwxr-xr-x 6 mysql mysql 512 Mar 16 00:03 mysql-test drwxr-xr-x 2 mysql mysql 512 Mar 16 00:03 scripts drwxr-xr-x 3 mysql mysql 512 Mar 16 00:03 share drwxr-xr-x 7 mysql mysql 1024 Mar 16 00:03 sql-bench drwxr-xr-x 2 mysql mysql 512 Mar 16 00:03 support-files drwxr-xr-x 2 mysql mysql 512 Mar 16 00:03 tests # ls -l /global/mysql-data-1 Total 30 drwxrwxrwx 9 mysql mysql 512 Apr 15 12:06 . drwxrwxrwx 20 root root 1024 Apr 10 12:41 .. drwxr-xr-x 2 mysql mysql 512 Apr 15 12:00 BDB drwxrwxrwx 2 mysql mysql 512 Apr 15 11:59 innodb drwxrwxrwx 2 mysql mysql 2048 Apr 15 14:47 logs -rw-r--r-- 1 mysql mysql 1432 Apr 15 11:58 my.cnf drwx------ 2 mysql mysql 512 Apr 15 11:59 mysql -rw-rw---- 1 mysql mysql 5 Apr 15 14:47 mysqld.pid drwx------ 2 mysql mysql 512 Apr 15 14:53 sc3_test_database drwx------ 2 mysql mysql 512 Apr 15 11:58 test drwx------ 2 mysql mysql 512 Apr 15 12:00 testdb # # ls -l /global/mysql-data-2 total 32 drwxrwxrwx 9 mysql mysql 512 Apr 15 07:49 . drwxrwxrwx 20 root root 1024 Apr 10 12:41 .. drwxr-xr-x 2 mysql mysql 512 Apr 14 11:16 BDB drwxr-xr-x 2 mysql mysql 512 Apr 14 11:14 innodb drwxr-xr-x 2 mysql mysql 2560 Apr 15 10:15 logs -rw-r--r-- 1 mysql mysql 1459 Apr 14 11:13 my.cnf drwx------ 2 mysql mysql 512 Apr 14 11:14 mysql -rw-rw---- 1 mysql mysql 5 Apr 15 10:10 mysqld.pid drwx------ 2 mysql mysql 512 Apr 15 10:10 sc3_test_database drwx------ 2 mysql mysql 512 Apr 14 11:14 test drwx------ 2 mysql mysql 512 Apr 14 11:16 testdb # more /etc/vfstab (Subset of the output) /dev/vx/dsk/dg1/vol01 /dev/vx/rdsk/dg1/vol01 /global/mysql ufs 2 yes global,logging /dev/vx/dsk/dg2/vol01 /dev/vx/rdsk/dg2/vol01 /global/mysql-data-1 ufs 2 yes global,logging /dev/vx/dsk/dg2/vol01 /dev/vx/rdsk/dg2/vol01 /global/mysql-data-2 ufs 2 yes global,logging # |
In the above example the Database directory for the MySQL instance 1 is /global/mysql-data-1, whereas the Database directory for the MySQL instance 2 is /global/mysql-data-2..
The following example shows MySQL installed on Local File Systems and two MySQL instances (mysql-data-1 and mysql-data-2) on Failover File Systems. The final output shows a subset of the /etc/vfstab entries for MySQL deployed using Veritas Volume Manager.
# ls -l /usr/local/mysql total 10432 drwxr-xr-x 13 mysql mysql 512 Mar 16 00:03 . drwxrwxrwx 7 root other 2048 Apr 11 09:53 .. -rw-r--r-- 1 mysql mysql 19106 Mar 15 23:29 COPYING -rw-r--r-- 1 mysql mysql 28003 Mar 15 23:29 COPYING.LIB -rw-r--r-- 1 mysql mysql 126466 Mar 15 16:47 ChangeLog -rw-r--r-- 1 mysql mysql 6811 Mar 15 23:29 INSTALL-BINARY -rw-r--r-- 1 mysql mysql 1937 Mar 15 16:47 README drwxr-xr-x 2 mysql mysql 1536 Mar 16 00:03 bin -rwxr-xr-x 1 mysql mysql 773 Mar 16 00:03 configure drwxr-x--- 4 mysql mysql 512 Mar 16 00:03 data drwxr-xr-x 2 mysql mysql 1024 Mar 16 00:03 include drwxr-xr-x 2 mysql mysql 512 Mar 16 00:03 lib drwxr-xr-x 3 mysql mysql 512 Mar 16 00:03 man -rw-r--r-- 1 mysql mysql 2676944 Mar 15 23:23 manual.html -rw-r--r-- 1 mysql mysql 2329252 Mar 15 23:23 manual.txt -rw-r--r-- 1 mysql mysql 98233 Mar 15 23:23 manual_toc.html drwxr-xr-x 6 mysql mysql 512 Mar 16 00:03 mysql-test drwxr-xr-x 2 mysql mysql 512 Mar 16 00:03 scripts drwxr-xr-x 3 mysql mysql 512 Mar 16 00:03 share drwxr-xr-x 7 mysql mysql 1024 Mar 16 00:03 sql-bench drwxr-xr-x 2 mysql mysql 512 Mar 16 00:03 support-files drwxr-xr-x 2 mysql mysql 512 Mar 16 00:03 tests # ls -l /local/mysql-data-1 Total 30 drwxrwxrwx 9 mysql mysql 512 Apr 15 12:06 . drwxrwxrwx 20 root root 1024 Apr 10 12:41 .. drwxr-xr-x 2 mysql mysql 512 Apr 15 12:00 BDB drwxrwxrwx 2 mysql mysql 512 Apr 15 11:59 innodb drwxrwxrwx 2 mysql mysql 2048 Apr 15 14:47 logs -rw-r--r-- 1 mysql mysql 1432 Apr 15 11:58 my.cnf drwx------ 2 mysql mysql 512 Apr 15 11:59 mysql -rw-rw---- 1 mysql mysql 5 Apr 15 14:47 mysqld.pid drwx------ 2 mysql mysql 512 Apr 15 14:53 sc3_test_database drwx------ 2 mysql mysql 512 Apr 15 11:58 test drwx------ 2 mysql mysql 512 Apr 15 12:00 testdb # #ls -l /local/mysql-data-2 total 32 drwxrwxrwx 9 mysql mysql 512 Apr 15 07:49 . drwxrwxrwx 20 root root 1024 Apr 10 12:41 .. drwxr-xr-x 2 mysql mysql 512 Apr 14 11:16 BDB drwxr-xr-x 2 mysql mysql 512 Apr 14 11:14 innodb drwxr-xr-x 2 mysql mysql 2560 Apr 15 10:15 logs -rw-r--r-- 1 mysql mysql 1459 Apr 14 11:13 my.cnf drwx------ 2 mysql mysql 512 Apr 14 11:14 mysql -rw-rw---- 1 mysql mysql 5 Apr 15 10:10 mysqld.pid drwx------ 2 mysql mysql 512 Apr 15 10:10 sc3_test_database drwx------ 2 mysql mysql 512 Apr 14 11:14 test drwx------ 2 mysql mysql 512 Apr 14 11:16 testdb # more /etc/vfstab (Subset of the output) /dev/vx/dsk/dg2/vol01 /dev/vx/rdsk/dg2/vol01 /local/mysql-data-1 ufs 2 yes logging /dev/vx/dsk/dg2/vol01 /dev/vx/rdsk/dg2/vol01 /local/mysql-data-2 ufs 2 yes logging # |
In the above example the Database directory for the MySQL instance 1 is /local/mysql-data-1, whereas the Database directory for the MySQL instance 2 is /local/mysql-data-2.
Your data service configuration might not be supported if you do not adhere to these requirements.
Use the requirements in this section to plan the installation and configuration of Sun Cluster HA for MySQL. These requirements apply to Sun Cluster HA for MySQL only. You must meet these requirements before you proceed with your Sun Cluster HA for MySQL installation and configuration.
MySQL components and their dependencies —The Sun Cluster HA for MySQL data service can be configured to protect a MySQL instance and its respective components. These components, and their dependencies between each other, are briefly described below.
Table 1–3 MySQL components and their dependencies (via -> symbol)
Componet |
Description |
---|---|
MySQL Server |
-> SUNW.HAStoragePlus resource The SUNW.HAStoragePlus resource manages the MySQL File System Mount points and ensures that MySQL is not started until these are mounted. |
The MySQL component has two configuration and registration files under /opt/SUNWscmys/util. These files allow you to register the MySQL component with Sun Cluster and prepare a MySQL instance to be registered
Within these files, the appropriate dependencies have already been applied.
# cd /opt/SUNWscmys # # ls -l util -rwxr-xr-x 1 root other 1208 Mar 25 13:49 ha_mysql_config -rwxr-xr-x 1 root other 820 Mar 25 13:55 ha_mysql_register -rwxr-xr-x 1 root other 1105 Apr 16 07:48 mysql_config -rwxr-xr-x 1 root other 2993 Apr 11 10:57 mysql_register # # more util/*config :::::::::::::: util/mysql_config :::::::::::::: # # Copyright 2003 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # This file will be sourced in by mysql_register and the parameters # listed below will be used. # # Where is mysql installed (BASEDIR) MYSQL_BASE= # Mysql admin-user for localhost MYSQL_USER= # Password for mysql admin user MYSQL_PASSWD= # Configured logicalhost MYSQL_HOST= # Specify a username for a faultmonitor user FMUSER= # Pick a password for that faultmonitor user FMPASS= # Socket name for mysqld ( Should be /tmp/<logical host>.sock ) MYSQL_SOCK=/tmp/<logical host>.sock # FOR SC3.1 ONLY, Specify the physical hostname for the # physical NIC that this logicalhostname belongs to for every node in the # cluster this Resourcegroup can located on. # IE: The logicalhost lh1 belongs to hme1 for physical-node phys-1 and # hme3 for physical-node phys-2. The hostname for hme1 is phys-1-hme1 and # for hme3 on phys-2 it is phys-2-hme3. # IE: MYSQL_NIC_HOSTNAME="phys-1-hme1 phys-2-hme3" MYSQL_NIC_HOSTNAME="" :::::::::::::: util/ha_mysql_config :::::::::::::: # # Copyright 2003 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # This file will be sourced in by ha_mysql_register and the parameters # listed below will be used. # # These parameters can be customized in (key=value) form # # RS - name of the resource for the application # RG - name of the resource group containing RS # BASEDIR - name of the Mysql bin directory # DATADIR - name of the Mysql Data directory # MYSQLUSER - name of the user Mysql should be started of # LH - name of the LogicalHostname SC resource # FMUSER - name of the Mysql fault monitor user # FMPASS - name of the Mysql fault monitor user password # LOGDIR - name of the directory mysqld should store it's logfile. # CHECK - should HA-MySQL check MyISAM index files before start YES/NO. # HAS_RS - name of the mysql HAStoragePlus SC resource # # The following examples illustrate sample parameters # for Mysql # # BASEDIR=/usr/local/mysql # DATADIR=/global/mysqldata # MYSQLUSER=mysql # LH=mysqllh # FMUSER=fmuser # FMPASS=fmuser # LOGDIR=/global/mysqldata/logs # CHECK=YES # RS= RG= BASEDIR= DATADIR= MYSQLUSER= LH= FMUSER= FMPASS= LOGDIR= CHECK= HAS_RS= # |
The my.cnf file — The Sun Cluster HA for MySQL data service provides two sample my.cnf files, one sample file for a master configuration and one for a slave configuration, however you should ensure that at least the following parameters are set.
The my.cnf file is a important file within MySQL. Therefore you are recommended to refer to the MySQL Documentation for complete configuration information on the parameters that follow.
MySQL my.cnffile in [mysqld]section in a master configuration
bind address has to be set to the defined logical host.
socket should be defined as /tmp/<logical host>.sock.
binlog-ignore-db should contain sc3_test_database if log-bin option is being used.
MySQL my.cnffile in [mysqld]section in a slave configuration
bind address has to be set to the defined logical host.
socket should be defined as /tmp/<logical host>.sock.
binlog-ignore-db should contain sc3_test_database if log-bin option is being used.
master—host is the hostname where the master instance resides.
master—user is the username the slave will use for indentification to the master.
master—password is the password the slave will use for indentification to the master.
master-info-file is the location of the file that remembers where we left off on the master during the replication process. This file should be placed on a GFS/FFS
This section contains the procedures you need to install and configure MySQL.
Throughout the following next sections, references will be made to certain directories for MySQL. The following list shows common pathnames for these references as shown in previous examples. Refer to Configuration Restrictions where these examples are shown.
MySQL installed from http://www.mysql.com on a Global File System, with a MySQL instance on a Global File System (Example 1–1)
MySQL Basedirectory— /global/mysql
MySQL Database directory — /global/mysqldata
MySQL installed on a Local File System, with mysql instances on a Failover File System (Example 1–2)
MySQL Basedirectory— /usr/local/mysql
MySQL Database directory — /local/mysqldata
Use this procedure to install and configure MySQL.
Determine how MySQL will be deployed in Sun Cluster – Here you need to determine how MySQL will be deployed.
Determine how many MySQL instances will be deployed.
Determine which Cluster File System will be used by each MySQL instance.
Mount the MySQL Cluster File Systems – Once you have determined how MySQL will be deployed within Sun Cluster, you must ensure the Cluster File Systems are mounted.
If Failover File Systems will be used by the MySQL instance, you must mount these manually.
Install MySQL onto all nodes within Sun Cluster – It is recommended that MySQL be installed onto a Global File System, however for a discussion of the advantages and disadvantages of installing the software on local versus cluster files systems, see “Determining the Location of the Application Binaries” in the Sun Cluster Data Services Installation and Configuration Guide.
Download MySQL from http://www.mysql.com — However, if you intend to use local disks for the MySQL software, you will need to repeat this step on all nodes within Sun Cluster.
Create a mysql-user and mysql-group for MySQL on all nodes in the cluster that will run MySQL
Change owner and group for MySQL binaries
Create your MySQL Database directory for your MySQL Instance(s) –
# mkdir <MySQL Database directory> # |
Refer back to Configuration Restrictions for a description of the <MySQL Database directory> and to Installing and Configuring MySQL for a list of common pathnames used from the examples in Configuration Restrictions and in the further example below.
The following example shows one MySQL instance. MySQL has been installed from http://www.mysql.com in /global/mysql which is mounted as a Global File System. The MySQL Database Directory for the MySQL instance is /global/mysql-data.
# cd /global/mysql # # ls -l -rw-r--r-- 1 mysql mysql 19106 Dec 10 14:52 COPYING -rw-r--r-- 1 mysql mysql 28003 Dec 10 14:52 COPYING.LIB -rw-r--r-- 1 mysql mysql 44577 Dec 5 10:37 ChangeLog -rw-r--r-- 1 mysql mysql 6811 Dec 10 14:53 INSTALL-BINARY -rw-r--r-- 1 mysql mysql 1976 Dec 5 10:37 README drwxr-xr-x 2 mysql mysql 1024 Dec 13 18:05 bin -rwxr-xr-x 1 mysql mysql 773 Dec 10 15:34 configure drwxr-x--- 3 mysql mysql 512 Apr 3 12:23 data drwxr-xr-x 2 mysql mysql 1024 Dec 10 15:35 include drwxr-xr-x 2 mysql mysql 512 Dec 10 15:35 lib drwxr-xr-x 2 mysql mysql 512 Dec 10 15:35 man -rw-r--r-- 1 mysql mysql 2582089 Dec 10 14:47 manual.html -rw-r--r-- 1 mysql mysql 2239278 Dec 10 14:47 manual.txt -rw-r--r-- 1 mysql mysql 94600 Dec 10 14:47 manual_toc.html drwxr-xr-x 6 mysql mysql 512 Dec 10 15:35 mysql-test drwxr-xr-x 2 mysql mysql 512 Dec 10 15:35 scripts drwxr-xr-x 3 mysql mysql 512 Dec 10 15:35 share drwxr-xr-x 7 mysql mysql 1024 Dec 10 15:35 sql-bench drwxr-xr-x 2 mysql mysql 512 Dec 10 15:35 support-files drwxr-xr-x 2 mysql mysql 512 Dec 10 15:35 tests # |
Create the MySQL my.cnf file according to your requirements — The Sun Cluster HA for MySQL data service provides two samples my.cnf file for MySQL, one sample configuration file is for a master configuration and one sample file is for a slave configuration.
If the Sun Cluster HA for MySQL package (SUNWscmys) was not installed during your initial Sun Cluster installation, you should proceed to Installing the Sun Cluster HA for MySQL Packages to install it on SC3.1 and SC3.0U3. Afterwards, return back here to continue the Installation and Configuration of MySQL.
The contents of /opt/SUNWscmys/etc/my.cnf_sample_[master|slave]provides a sample MySQL configuration file that you can use to create your MySQL instance <MySQL Databasedirectory>/my.cnf. However, note that you must still edit that file to reflect your configuration values.
# cp /opt/SUNWscmys/etc/my.cnf_sample_master \ <MySQL Databasedirectory>/my.cnf |
Bootstrap MySQL instance — That will create the privilege tables db, host, user, tables_priv and columns_priv in the mysql database, as well as the func table
# cd <MySQL Basedirectory> |
# ./scripts/mysql_install_db \ --datadir=<MySQL Database directory> |
Create a logfile directory in <MySQL Database Directory>
# mkdir <MySQL Database Directory>/logs |
Change owner and group for <MySQL Database Directory>
# chown -R mysql:mysql <MySQL Database Directory> |
Change filepermission for <MySQL Database Directory>/my.cnf
# chmod 644 <MySQL Database Directory>/my.cnf |
This section contains the procedure you need to verify the installation and configuration.
Use this procedure to verify the installation and configuration. This procedure does not verify that your application is highly available because you have not yet installed your data service.
Before verifying the Installation and Configuration of MySQL, ensure that the Logical Hostname for the mysql is available. To do this you will need to complete steps 2 through 7 in How to Register and Configure Sun Cluster HA for MySQL as a Failover Service.
Start the MySQL Server for this instance
#cd <MySQL Basedirectory> |
# ./bin/mysqld --defaults-file=<MySQL Databasedirectry>/my.cnf \ --basedir=<MySQL Basedirectory>\ --datadir=<MySQL Databasedirectory>\ --user=mysql\ --pid-file=<MySQL Databasedirectory>/mysqld.pid & |
Connect to the MySQL instance
# <MySQL Basedirectory>/bin/mysql -h <Logical host> -uroot |
Stop the MySQL server instance
# kill -TERM `cat <MySQL Databasedirectory>/mysqld.pid |
If you did not install the Sun Cluster HA for MySQL packages during your initial Sun Cluster installation, perform this procedure to install the packages. Perform this procedure on each cluster node where you are installing the Sun Cluster HA for MySQL packages. To complete this procedure, you need the Sun Cluster Agents CD-ROM.
If you are installing more than one data service simultaneously, perform the procedure in “Installing the Software” in Sun Cluster 3.1 10/03 Software Installation Guide.
Install the Sun Cluster HA for MySQL packages by using one of the following installation tools:
The Web Start program
The scinstall utility
The Web Start program is not available in releases earlier than Sun Cluster 3.1 Data Services 10/03.
You can run the Web Start program with a command-line interface (CLI) or with a graphical user interface (GUI). The content and sequence of instructions in the CLI and the GUI are similar. For more information about the Web Start program, see the installer(1M) man page.
On the cluster node where you are installing the Sun Cluster HA for MySQL packages, become superuser.
(Optional) If you intend to run the Web Start program with a GUI, ensure
that your DISPLAY
environment
variable is set.
Load the Sun Cluster Agents CD-ROM into the CD-ROM drive.
If the Volume Management daemon vold(1M) is running and configured to manage CD-ROM devices, it automatically mounts the CD-ROM on the /cdrom/scdataservices_3_1_vb directory.
Change to the Sun Cluster HA for MySQL component directory of the CD-ROM.
The Web Start program for the Sun Cluster HA for MySQL data service resides in this directory.
# cd /cdrom/scdataservices_3_1_vb/components/SunCluster_HA_MySQL_3.1 |
Start the Web Start program.
# ./installer |
When you are prompted, select the type of installation.
Follow instructions on the screen to install the Sun Cluster HA for MySQL packages on the node.
After the installation is finished, the Web Start program provides an installation summary. This summary enables you to view logs that the Web Start program created during the installation. These logs are located in the /var/sadm/install/logs directory.
Exit the Web Start program.
Unload the Sun Cluster Agents CD-ROM from the CD-ROM drive.
Use this procedure to install the Sun Cluster HA for MySQL packages by using scinstall utility on SC3.1. You need the Sun Cluster Agents CD-ROM to perform this procedure. This procedure assumes that you did not install the data service packages during your initial Sun Cluster installation.
If you installed the Sun Cluster HA for MySQL packages as part of your initial Sun Cluster installation, proceed to Registering and Configuring Sun Cluster HA for MySQL.
Otherwise, use this procedure to install the Sun Cluster HA for MySQL packages. Perform this procedure on all nodes that can run Sun Cluster HA for MySQL data service.
Load the Sun Cluster Agents CD-ROM into the CD-ROM drive.
Run the scinstall utility with no options.
This step starts the scinstall utility in interactive mode.
Choose the menu option, Add Support for New Data Service to This Cluster Node.
The scinstall utility prompts you for additional information.
Provide the path to the Sun Cluster Agents CD-ROM.
The utility refers to the CD as the “data services cd.”
Specify the data service to install.
The scinstall utility lists the data service that you selected and asks you to confirm your choice.
Exit the scinstall utility.
Unload the CD from the drive.
This section contains the procedures you need to configure Sun Cluster HA for MySQL.
Use this procedure to configure Sun Cluster HA for MySQL as a failover data service. This procedure assumes that you installed the data service packages during your initial Sun Cluster installation.
If you did not install the Sun Cluster HA for MySQL packages as part of your initial Sun Cluster installation, go to How to Install the Sun Cluster HA for MySQL Packages by Using the scsintall Utility.
Otherwise, use this procedure to configure the Sun Cluster HA for MySQL data service as a failover service.
Become superuser on one of the nodes in the cluster that will host MySQL.
Register the SUNW.gds resource type.
# scrgadm -a -t SUNW.gds |
Register the SUNW.HAStoragePlus resource type.
# scrgadm -a -t SUNW.HAStoragePlus |
Create a failover resource group .
# scrgadm -a -g MySQL-failover-resource-group |
Create a resource for the MySQL Disk Storage.
# scrgadm -a -j MySQL-has-resource \ -g MySQL-failover-resource-group \ -t SUNW.HAStoragePlus \ -x FilesystemMountPoints=MySQL- instance-mount-points |
Create a resource for the MySQL Logical Hostname.
# scrgadm -a -L -j MySQL-lh-resource \ -g MySQL-failover-resource-group \ -l MySQL-logical-hostname |
Enable the failover resource group that now includes the MySQL Disk Storage and Logical Hostname resources.
# scswitch -Z -g MySQL-failover-resource-group |
Make sure that the resourcegroup is enabled on the same node as what was used when mysql_install_db was executed.
Start the MySQL Server instance manually
#cd <MySQL Basedirectory> |
# ./bin/mysqld --defaults-file=<MySQL Databasedirectry>/my.cnf \ --basedir=<MySQL Basedirectory>\ --datadir=<MySQL Databasedirectory>\ --user=mysql\ --pid-file=<MySQL Databasedirectory>/mysqld.pid & |
Configure the admin password for the adminuser
# <MySQL Databasedirectry>/bin/mysqladmin -S /tmp/<Logical host>.sock password 'admin password' |
Create faultmonitor-user and a test-database for the MySQL instance
# cd /opt/SUNWscmys/util |
Edit the mysql_config file and follow the comments within that file, ie
# Where is mysql installed (BASEDIR) MYSQL_BASE= # Mysql admin-user for localhost (Should be root) MYSQL_USER= # Password for mysql admin user MYSQL_PASSWD= # Configured logicalhost MYSQL_HOST= # Specify a username for a faultmonitor user FMUSER= # Pick a password for that faultmonitor user FMPASS= # Socket name for mysqld ( Should be /tmp/<Logical host>.sock ) MYSQL_SOCK= # FOR SC3.1 ONLY, Specify the physical hostname for the # physical NIC that this logicalhostname belongs to for every node in th e # cluster this Resourcegroup can located on. # IE: The logicalhost lh1 belongs to hme1 for physical-node phys-1 and # hme3 for physical-node phys-2. The hostname for hme1 is phys-1-hme1 a nd # for hme3 on phys-2 it is phys-2-hme3. # IE: MYSQL_NIC_HOSTNAME="phys-1-hme1 phys-2-hme3" MYSQL_NIC_HOSTNAME="" |
The following is an example for MySQL instance on SC3.1.
MYSQL_BASE=/global/mysql MYSQL_USER=root MYSQL_PASSWD=root MYSQL_HOST=hahostix1 FMUSER=fmuser FMPASS=fmuser MYSQL_SOCK=/tmp/hahostix1.sock MYSQL_NIC_HOSTNAME="clusterix1 clusterix2" |
If SC3.0U3 is being used the MYSQL_NIC_HOSTNAME parameter can be omitted.
After editing mysql_config you must now run the mysql_register script.
# ./mysql_register |
Stop the MySQL Server instance manually
# kill -TERM `cat <MySQL Databasedirectry>/mysqld.pid |
Create and register MySQL as a failover data service
# cd /opt/SUNWscmys/util |
Edit the ha_mysql_config file and follow the comments within that file, i.e.
These parameters can be customized in (key=value) form # # RS - name of the resource for the application # RG - name of the resource group containing RS # BASEDIR - name of the Mysql bin directory # DATADIR - name of the Mysql Data directory # MYSQLUSER - name of the user Mysql should be started with # LH - name of the LogicalHostname SC resource # FMUSER - name of the Mysql fault monitor user # FMPASS - name of the Mysql fault monitor user password # LOGDIR - name of the directory mysqld should store it's logfile. # CHECK - should HA-MySQL check MyISAM index files before start YES/ NO. # HAS_RS - name of the MySQL HAStoragePlus SC resource # |
The following is an example for MySQL instance.
RS=mysql-res RG=mysql-rg BASEDIR=/global/mysql DATADIR=/global/mysql-data MYSQLUSER=mysql LH=hahostix1 FMUSER=fmuser FMPASS=fmuser LOGDIR=/global/mysql-data/logs CHECK=YES HAS_RS=mysql-has-res |
Enable each MySQL resource.
Repeat this step for each MySQL instance, if multiple instances were created.
# scstat -g # scswitch -e -j MySQL-resource |
Add adminuser for accessing locally a MySQL instance with a MySQL Logicalhost.
If you only want to access the MySQL instance through the socket (localhost) this step can be omitted.
When bootstraping MySQL the command mysql_install_db will create two adminusers, one belonging to localhost and one belonging to the node which mysql_install_db was executed on.
If SC3.0U3 is being used you should delete the root user belonging to the physical node and add a adminuser belonging to the logicalhost
The following is an example for MySQL instance on SC3.0U3
# mysql -S /tmp/hahostix1.sock -uroot mysql> use mysql; mysql> DELETE FROM user where User='root' AND Host='clusterix1'; mysql> GRANT ALL ON *.* TO 'root'@'hahostix1' IDENTIFIED BY 'rootpasswd'; mysql> exit; |
If SC3.1 is being used you should add a adminuser for every physical-node in the cluster that will run this MySQL instance.
If the nodename and the hostname for the physical insterface is different then the hostname for the physical interface should be used.
The following is an example for MySQL instance on SC3.1.
# mysql -S /tmp/hahostix1.sock -uroot mysql> use mysql; mysql> mysql> GRANT ALL ON *.* TO 'root'@'clusterix2' IDENTIFIED BY 'rootpasswd'; mysql> mysql> GRANT ALL ON *.* TO 'root'@'clusterix1' IDENTIFIED BY 'rootpasswd'; mysql> exit; |
You have to manually add the Grant_priv to the admin users, See MySQL Administration documentation.
This section contains the procedure you need to verify that you installed and configured your data service correctly.
Use this procedure to verify that you installed and configured Sun Cluster HA for MySQL correctly.
Become superuser on one of the nodes in the cluster that will host MySQL.
Ensure all the MySQL resources are online with scstat.
# scstat |
For each MySQL resource that is not online, use the scswitch command as follows.
# scswitch -e -j MySQL- resouce |
Run the scswitch command to switch the MySQL resource group to another cluster node, such as node2.
# scswitch -z -g MySQL-failover-resource-group -h node2 |
Use the information in this section to understand the Sun Cluster HA for MySQL fault monitor. This section describes the Sun Cluster HA for MySQL fault monitor's probing algorithm or functionality, states the conditions, messages, and recovery actions associated with unsuccessful probing.
For conceptual information on fault monitors, see the Sun Cluster Concepts Guide.
The Sun Cluster HA for MySQL fault monitor uses the same resource properties as resource type SUNW.gds, refer to the SUNW.gds(5) man page for a complete list of resource properties used.
MySQL
Sleeps for Thorough_probe_interval
Tries to connect to the MySQL instance, with mysqladmin command with argument ping, with the defined faultmonitor user fault <fmuser>. If this fails then the probe will restart the MySQL resource.
Every 300 seconds the probe will also check the following:
If the MySQL instance is a slave configuration, the probe will check if the MySQL instance is connected to it's master. If the Slave is not connected the probe will write an error message to syslog.
Verify that the probe can list all databases and tables, not the contents. If the probe recieve any errors the probe will write an error message to syslog.
Conduct an function test on the defined test-database, Create Table, Insert into Table, Update Table, Delete from Table and Drop table. If any of those operation fails then the probe will restart the MySQL resource.
If all MySQL processes have died, pmf will interrupt the probe to immediately restart the mysql resource.
If the MySQL resource is repeatedly restarted and subsequently exhausts the Retry_count within the Retry_interval then a failover is initiated for the Resource Group onto another node if Failover_enabled is set to TRUE
Use the information in this section to understand how to turn on debug for Sun Cluster HA for MySQL.
Sun Cluster HA for MySQL can be used by multiple MySQL instances. However, it is possible to turn debug on for all MySQL instances or a particular MySQL instance.
Each MySQL component has a DEBUG file under /opt/SUNWscmys/etc, where xxx is a three character abbreviation for the respective MySQL component.
These files allow you to turn debug on for all MySQL instances or for a specific MySQL instance on a particular node with Sun Cluster. If you require debug to be turned on for Sun Cluster HA for MySQL across the whole Sun Cluster, you will need to repeat this step on all nodes within Sun Cluster.
Edit /etc/syslog.conf
Edit /etc/syslog.conf and change daemon.notice to daemon.debug
# grep daemon /etc/syslog.conf *.err;kern.debug;daemon.notice;mail.crit /var/adm/messages *.alert;kern.err;daemon.err operator # |
Change the daemon.notice to daemon.debug and restart syslogd. Note that the output below, from the command grep daemon /etc/syslog.conf, shows that daemon.debug has now been set.
# grep daemon /etc/syslog.conf *.err;kern.debug;daemon.debug;mail.crit /var/adm/messages *.alert;kern.err;daemon.err operator # # pkill -1 syslogd # |
Edit /opt/SUNWscmys/etc/config
Edit /opt/SUNWscmys/etc/config and change DEBUG= to DEBUG=ALL or DEBUG=resource
# cat /opt/SUNWscmys/etc/config # # Copyright 2003 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # Usage: # DEBUG=<RESOURCE_NAME> or ALL # DEBUG=ALL # |
To turn off debug, simply reverse the steps above.
Use the information in this section to understand how to upgrade to SC3.1 when using Sun Cluster HA for MySQL.
The step showed will not describe how to upgrade to SC3.1 only the steps to upgrade Sun Cluster HA for MySQL to SC3.1 are mentioned.
Shutdown Sun Cluster HA for MySQL resource with scswitch —n —j MySQL- resouce
# scswitch -n -j MySQL- resouce |
Upgrade the nodes to SC3.1 according to Sun Cluster documentations.
Start the MySQL Server manually on SC3.1
#cd <MySQL Basedirectory> |
# ./bin/mysqld --defaults-file=<MySQL Databasedirectry>/my.cnf \ --basedir=<MySQL Basedirectory>\ --datadir=<MySQL Databasedirectory>\ --user=mysql\ --pid-file=<MySQL Databasedirectory>/mysqld.pid & |
Access the MySQL instance from local node with the socket option.
#<MySQL Basedirectory> /bin/mysql -S <MySQL Socket> -uroot \ -p<Adminpassword>\ |
The following is an example for a MySQL instance
# mysql -s /tmp/hahostix1.sock -uroot -proot mysql> |
Drop the Sun Cluster HA for MySQL test database sc3_test_database
# mysql -s /tmp/hahostix1.sock -uroot -proot mysql> DROP DATABASE sc3_test_database; Query OK, 0 rows affected (0.03 sec) |
Delete all entries in db-table in mysql-database that contain User='<MySQL Faultmonitor user>'
# mysql -s /tmp/hahostix1.sock -uroot -proot mysql> use mysql; Database changed mysql> DELETE FROM db WHERE User='fmuser'; Query OK, 1 row affected (0.03 sec) |
Delete all entries in user-table in mysql-database that contain User='<MySQL Faultmonitor user>'
# mysql -s /tmp/hahostix1.sock -uroot -proot mysql> use mysql; Database changed mysql> DELETE FROM user WHERE User='fmuser'; Query OK, 1 row affected (0.03 sec) |
Add faultmonitor-user and a test-database to MySQL
# cd /opt/SUNWscmys/util |
Edit the mysql_config file and follow the comments within that file, ie
# Where is mysql installed (BASEDIR) MYSQL_BASE= # Mysql admin-user for localhost (Should be root) MYSQL_USER= # Password for mysql admin user MYSQL_PASSWD= # Configured logicalhost MYSQL_HOST= # Specify a username for a faultmonitor user FMUSER= # Pick a password for that faultmonitor user FMPASS= # Socket name for mysqld ( Should be /tmp/<Logical host>.sock ) MYSQL_SOCK= # FOR SC3.1 ONLY, Specify the physical hostname for the # physical NIC that this logicalhostname belongs to for every node in the # cluster this Resourcegroup can located on. # IE: The logicalhost lh1 belongs to hme1 for physical-node phys-1 and # hme3 for physical-node phys-2. The hostname for hme1 is phys-1-hme1 and # for hme3 on phys-2 it is phys-2-hme3. # IE: MYSQL_NIC_HOSTNAME="phys-1-hme1 phys-2-hme3" MYSQL_NIC_HOSTNAME="" |
The following is an example for MySQL instance on SC3.1.
MYSQL_BASE=/global/mysql MYSQL_USER=root MYSQL_PASSWD=root MYSQL_HOST=hahostix1 FMUSER=fmuser FMPASS=fmuser MYSQL_SOCK=/tmp/hahostix1.sock MYSQL_NIC_HOSTNAME="clusterix1 clusterix2" |
After editing mysql_config you must now run the mysql_register script.
# ./mysql_register |
Stop the MySQL Server manually
# kill -TERM `cat <MySQL Databasedirectry>/mysqld.pid |
Startup Sun Cluster HA for MySQL resource with scswitch —e —j MySQL- resouce
# scswitch -e -j MySQL- resouce |
Change sourceaddress for adminuser for accessing locally a MySQL instance with a MySQL Logicalhost.
If you only want to access the MySQL instance through the socket (localhost) this step can be omitted.
When SC3.0U3 has been used you should delete the root user beloning to the logicalhost and add a adminusers belonging to the physicalhost.
If the nodename and the hostname for the physical insterface is different then the hostname for the physical interface should be used.
The following is an example for MySQL instance on SC3.1
# mysql -S /tmp/hahostix1.sock -uroot mysql> use mysql; mysql> DELETE FROM user where User='root' AND Host='hahostix1'; mysql> GRANT ALL ON *.* TO 'root'@'clusterix1' IDENTIFIED BY 'rootpasswd'; mysql> GRANT ALL ON *.* TO 'root'@'clusterix2' IDENTIFIED BY 'rootpasswd'; mysql> exit; |
You have to manually add the Grant_priv to the admin users, See MySQL Administration documentation.
Use the information in this section to understand how to upgrade to 4.0.12 when using Sun Cluster HA for MySQL.
The step showed will not describe how to upgrade to 4.0.12 only the steps to upgrade Sun Cluster HA for MySQL to 4.0.12 are mentioned. This steps assumes that the new MySQL binaries is installed in the same place. If the new binaries is installed in a new directory the MySQL resource has to be re-registered with new MySQL Basedir.
Shutdown the Sun Cluster HA for MySQL with scswitch —n —j MySQL- resouce
# scswitch -n -j MySQL- resouce |
Install the new MySQL binaries, follow Step 3 and 4 in Section How to Install and Configure MySQL.
Startup Sun Cluster HA for MySQL with scswitch —e —j MySQL- resouce
# scswitch -e -j MySQL- resouce |
Shutdown Sun Cluster HA for MySQL faultmonitor with scswitch —n –M —j MySQL- resouce
# scswitch -n -M -j MySQL- resouce |
Follow MySQL Documentation in how to upgrade MySQL Database.
Startup Sun Cluster HA for MySQL faultmonitor with scswitch —e –M —j MySQL- resouce
# scswitch -e -M -j MySQL- resouce |