JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Cluster Data Service for MySQL Guide     Oracle Solaris Cluster 3.3 3/13
search filter icon
search icon

Document Information

Preface

1.  Installing and Configuring HA for MySQL

Installing and Configuring HA for MySQL

HA for MySQL Overview

Planning the HA for MySQL Installation and Configuration

MySQL and Oracle Solaris Containers

Configuration Restrictions

Restriction for the HA for MySQL Data Service Configuration

Restrictions on the MySQL Configuration File

Restrictions for the MySQL Configurations

Restrictions on the MySQL Database Directory

Restriction for the MySQL smf Service Name in an HA Container

Examples for the File Systems Layout

Configuration Requirements

Components and Their Dependencies for HA for MySQL

Registration and Configuration File for HA for MySQL

Explanation of the my.cnf File

Installing and Configuring MySQL

Enabling MySQL to Run in a Global Zone Configuration

How to Enable MySQL for a Failover Resource

How to Enable MySQL to Run in a Scalable Configuration

How to Enable MySQL to Run in a Multiple-Master Configuration

How to Install and Configure MySQL in a Global Zone

Enabling MySQL to Run in a Zone Configuration

How to Enable MySQL for a Failover Resource

How to Enable MySQL to Run in a Scalable Configuration

How to Enable MySQL to Run in a Multiple-Master Configuration

How to Install and Configure MySQL in a Zone

How to Enable MySQL to run in an HA Container Configuration

How to Install and Configure MySQL in an HA Container

Verifying the Installation and Configuration of MySQL

How to Verify the Installation and Configuration of MySQL

Installing the HA for MySQL Packages

How to Install the HA for MySQL Packages

Registering and Configuring HA for MySQL

How to Register and Configure HA for MySQL as a Failover Service in a Global Zone Configuration

How to Register and Configure HA for MySQL as a Failover Service in a Zone Configuration

How to Register and Configure HA for MySQL as a Failover Service in an HA Container Configuration

How to Modify Parameters in the HA for MySQL Manifest

How to Remove an HA for MySQL Resource From an HA Container

How to Add an HA for MySQL Resource in a Scalable or Multiple-Master Configuration

Verifying the HA for MySQL Installation and Configuration

How to Verify the HA for MySQL Installation and Configuration

Understanding the HA for MySQL Fault Monitor

Resource Properties

Probing Algorithm and Functionality

Debugging the HA for MySQL

How to Activate Debugging for HA for MySQL

Upgrade to Oracle Solaris Cluster 3.3 1/13 Software When Using HA for MySQL

Upgrade to MySQL 4.x.x From 3.23.54 When Using HA for MySQL

Upgrade to MySQL Version 4.x.x From Version 3.23.54

A.  Deployment Example: Installing MySQL in the Global Zone

B.  Deployment Example: Installing MySQL in the Non-Global HA Container

C.  Deployment Example: Installing MySQL in a Non-Global Zone

D.  Deployment Example: Installing MySQL in a Scalable or Multiple-Master Configuration

Index

Registering and Configuring HA for MySQL

This section contains the procedures you need to configure HA for MySQL. According to your zone type, you need to complete one of the first three of the following tasks.

How to Register and Configure HA for MySQL as a Failover Service in a Global Zone Configuration

This procedure assumes that you installed the data service packages during your initial Oracle Solaris Cluster installation.

If you did not install the HA for MySQL packages as part of your initial Oracle Solaris Cluster installation, go to Installing the HA for MySQL Packages.

  1. Become superuser or assume a role that provides solaris.cluster.admin RBAC authorization on the node in the cluster that host MySQL.
  2. Start the MySQL Server instance manually.
    # cd MySQL-Base- directory
    # ./bin/mysqld --defaults-file=MySQL-Database-directory/my.cnf \
    --basedir=MySQL-Base-directory \
     --datadir=MySQL-Database-directory \ 
     --user=mysql \
     --pid-file=MySQL-Database-directory/mysqld.pid &
  3. Configure the administrator password for the administrative user.
    # MySQL-Database-directory/bin/mysqladmin \
    -S /tmp/logical-host.sock password 'admin password'
  4. Add the administrative user for locally accessing a MySQL instance with a MySQL logical-host-ip-name.

    Note - If you want to access the MySQL instance only through the socket (localhost), omit this step.


    When bootstrapping MySQL the command mysql_install_db creates two administrative users, one belonging to localhost and one belonging to the node on which mysql_install_db was executed.

    Add an administrative user for every global-cluster node that runs this MySQL instance.


    Note - If the node name and the hostname for the physical interface are different, use the hostname for the physical interface.


    The following is an example for a MySQL instance.

    # mysql -S /tmp/hahostix1.sock -uroot -p'admin-password'
    mysql> use mysql;
    mysql> GRANT ALL ON *.* TO 'root'@'clusterix2' IDENTIFIED BY 'rootpasswd';
    mysql> GRANT ALL ON *.* TO 'root'@'clusterix1' IDENTIFIED BY 'rootpasswd';
    mysql> exit;

    Note - You must manually add Grant_priv to the administrative users. See the MySQL administration documentation.


    The following is an example for a MySQL 4.x or 5.0.x instance.

    # mysql -S /tmp/hahostix1.sock -uroot -p'admin-password'
    mysql> use mysql;
    mysql> UPDATE user SET Grant_priv='Y' WHERE User='root' AND Host='clusterix1';
    mysql> UPDATE user SET Grant_priv='Y' WHERE User='root' AND Host='clusterix2';
    mysql> exit;

    Note - If you experience any problems here, refer to the MySQL administration documentation.


  5. Copy the MySQL configuration files to your home directory.
    # cp /opt/SUNWscmys/util/ha_mysql_config /home-dir
    # cp /opt/SUNWscmys/util/mysql_config /home-dir
  6. Create a faultmonitor-user and a test-database for the MySQL instance.
    # cd home-dir

    Edit the mysql_config file and follow the comments within that file, i.e.

    #
    # CDDL HEADER START
    #
    # The contents of this file are subject to the terms of the
    # Common Development and Distribution License (the License).
    # You may not use this file except in compliance with the License.
    #
    # You can obtain a copy of the license at usr/src/CDDL.txt
    # or http://www.opensolaris.org/os/licensing.
    # See the License for the specific language governing permissions
    # and limitations under the License.
    #
    # When distributing Covered Code, include this CDDL HEADER in each
    # file and include the License file at usr/src/CDDL.txt.
    # If applicable, add the following below this CDDL HEADER, with the
    # fields enclosed by brackets [] replaced with your own identifying
    # information: Portions Copyright [yyyy] [name of copyright owner]
    #
    # CDDL HEADER END
    #
    
    #
    # Copyright (c) 2006,2012, Oracle and/or its affiliates.  All rights reserved.
    # Use is subject to license terms.
    #
    
    #ident  "@(#)mysql_config.ksh   1.11   12/08/20"
    
    # 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 (Default is root)
    MYSQL_USER=
    
    # Password for mysql admin user, if you do not want to disclose this passowrd in
    # a file, leave the MYSQL_PASSWD variable empty, or take it out.
    MYSQL_PASSWD=
    
    # Configured logicalhost. For scalable or multiple-master resources, leave it empty.
    MYSQL_HOST=
    
    # Specify a username for a faultmonitor user
    FMUSER=
    
    # Pick a password for that faultmonitor user, if you do not want to disclose this
    # password in a file, leave the FMPASS variable empty, or take it out.
    FMPASS=
    
    # Socket name for mysqld ( Should be /tmp/<logical-host>.sock )
    MYSQL_SOCK=
    
    # Specify the physical hostname for the physical NIC that this logical hostname 
    # belongs to for every node in the cluster this resource group can be located on.
    # If you use the mysql_geocontrol features to implement the MySQL replication as 
    # the replication protocol in Oracle Solaris Cluster geographic edition, specify all
    # physical nodes of all clusters. Specify at least all the nodes on both sites
    # where the MySQL databases can be hosted.
    # 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-hme0 and
    # for hme3 on phys-2 it is phys-2-hme3.
    # IE: MYSQL_NIC_HOSTNAME="phys-1-hme0 phys-2-hme3"
    # IE: If two clusters are tied together by the mysql_geocontrol features, assuming the
    # MySQL database on cluster one belongs to cl1-phys1-hme0 and cl1-phys2-hme3, the
    # MySQL database on cluster two belongs to cl2-phys1-hme2 and cl2-phys2-hme4. Then the  
    # MYSQL_NIC_HOSTNAME variable needs to be set to:
    # MYSQL_NIC_HOSTNAME="cl1-phys1-hme0 cl1-phys2-hme3 cl2-phys1-hme2 cl2-phys2-hme4"
    
    MYSQL_NIC_HOSTNAME=
    
    # Where are your databases installed? (location of my.cnf)
    MYSQL_DATADIR=
    
    # Is MySQL Cluster installed?
    # Any entry here triggers the ndb engine check preparation. If no MySQL cluster should be
    # checked, leave it empty.
    NDB_CHECK=

    The following is an example for a MySQL instance.

    MYSQL_BASE=/global/mysql
    MYSQL_USER=root
    MYSQL_PASSWD=
    MYSQL_HOST=hahostix1
    FMUSER=fmuser
    FMPASS=
    MYSQL_SOCK=/tmp/hahostix1.sock
    MYSQL_NIC_HOSTNAME="clusterix1 clusterix2"
    MYSQL_DATADIR=/global/mysql-data

    After editing mysql_config, you must run the mysql_register script.

    # /opt/SUNWscmys/util//mysql_register -f home-dir/mysql_config
  7. Stop the MySQL Server instance manually.
    # kill -TERM `cat MySQL-Database-directry/mysqld.pid
  8. Create and register MySQL as a failover data service.
    1. Navigate to the home-dir directory.
      # cd home-dir
    2. Edit the ha_mysql_config file and follow the comments within that file.
      #
      # CDDL HEADER START
      #
      # The contents of this file are subject to the terms of the
      # Common Development and Distribution License (the License).
      # You may not use this file except in compliance with the License.
      #
      # You can obtain a copy of the license at usr/src/CDDL.txt
      # or http://www.opensolaris.org/os/licensing.
      # See the License for the specific language governing permissions
      # and limitations under the License.
      #
      # When distributing Covered Code, include this CDDL HEADER in each
      # file and include the License file at usr/src/CDDL.txt.
      # If applicable, add the following below this CDDL HEADER, with the
      # fields enclosed by brackets [] replaced with your own identifying
      # information: Portions Copyright [yyyy] [name of copyright owner]
      #
      # CDDL HEADER END
      #
      
      #
      # Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
      #
      
      #ident  "@(#)ha_mysql_config.ksh        1.9     12/08/20"
      
      # 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
      #  SCALABLE - flag to indicate a sclable resource creation.
      #             The default is no, so any enty here triggers a scalable resource.
      # LB_POLICY - Set the loadbalancing policy for a scalable mysql service.
      #             Use the values defined for the standard resource property
      #             Load_balancing_policy. If you do not specify it, the defaults are 
      #             used.
      #   RS_PROP - Additional resource properties in the format for clresource create,
      #             example "-p start_timeout=600"
      #
      #        To have the mysql agent local zone aware, 4 Variables are needed:
      #      ZONE - the zone name where the Mysql Database should run in
      #             Optional
      #    ZONEBT - The resource name which controls the zone. 
      #             Optional
      #   PROJECT - A project in the zone, that will be used for this service
      #             specify it if you have an su - in the start stop or probe,
      #             or to define the smf credentials. If the variable is not set,
      #             it will be translated as :default for the sm and default 
      #             for the zsh component
      #             Optional
      #     ZUSER - A user in the the zone which is used for the smf method 
      #             credentials. Your smf service will run under this user
      #             Optional
      #
      # Mysql specific Variables
      #
      #   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
      # MYSQLHOST - name of the host in /etc/hosts. For scalable/multiple master resources leave it empty 
      #    FMUSER - name of the Mysql fault monitor user
      #    FMPASS - name of the Mysql fault monitor user password
      #             If you do not want to store the password readable in a file, leave the FMPASS variable 
      #             empty. 
      #    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
      # NDB_CHECK - Is MySQL Cluster installed?
      #             Any entry here triggers the ndb engine check, if no MySQL cluster should be checked 
      #             leave it empty.
      # 

      The following is an example for a MySQL instance.

      RS=mysql-res
      RG=mysql-rg
      BASEDIR=/global/mysql
      DATADIR=/global/mysql-data
      MYSQLUSER=mysql
      LH=hahostix1
      MYSQLHOST=hahostix1
      FMUSER=fmuser
      FMPASS=
      LOGDIR=/global/mysql-data/logs
      CHECK=YES 
      HAS_RS=mysql-has-res
      ZONE=
      ZONE_BT=
      PROJECT=
    3. (Optional) If you did not specify the FMPASS variable, call the following script on all nodes or zones which can host the MySQL database.
      # /opt/SUNWscmys/util/ha_mysql_register -f home-dir/ha_mysql_config -e 
    4. Register the MySQL resource.
      # /opt/SUNWscmys/util/ha_mysql_register -f home-dir/ha_mysql_config
  9. Enable each MySQL resource.

    Repeat this step for each MySQL instance, if multiple instances were created.

    # clresource status
    # clresource enable MySQL-resource

How to Register and Configure HA for MySQL as a Failover Service in a Zone Configuration

This procedure assumes that you installed the data service packages during your initial Oracle Solaris Cluster installation.

If you did not install the HA for MySQL packages as part of your initial Oracle Solaris Cluster installation, go to Installing the HA for MySQL Packages.

  1. Log in to the zone on the node that hosts yourMySQLresource-group.
  2. Become superuser or assume a role that provides solaris.cluster.admin RBAC authorization on the node's zone in the cluster that hosts MySQL.
  3. Start the MySQL server instance manually.
    # cd MySQL-base-directory
    # ./bin/mysqld --defaults-file=MySQL-Database-directory/my.cnf \
    --basedir=MySQL-Base-directory \
     --datadir=MySQL-Database-directory \
     --user=mysql \
     --pid-file=MySQL-Database-directory/mysqld.pid &
  4. Configure the administrator password for the administrative user.
    # MySQL-Database-directory/bin/mysqladmin \
    -S /tmp/logical-host.sock password 'admin password'
  5. Add the administrative user for accessing locally a MySQL instance with a MySQL logical-host-ip-name.

    Note - If you want to access the MySQL instance only through the socket (localhost), omit this step.


    When bootstrapping MySQL the command mysql_install_db creates two administrative users, one belonging to localhost and one belonging to the node on which mysql_install_db was executed.

    Add an administrative user for every physical node in the cluster that runs this MySQL instance.


    Note - If the node name and the hostname for the physical interface are different, use the hostname for the physical interface.


    The following is an example for a MySQL instance.

    # mysql -S /tmp/hahostix1.sock -uroot -p'adminpassword'
    mysql> use mysql;
    mysql> GRANT ALL ON *.* TO 'root'@'zone1' IDENTIFIED BY 'rootpasswd';
    mysql> GRANT ALL ON *.* TO 'root'@'zone2' IDENTIFIED BY 'rootpasswd';
    mysql> exit;

    Note - You have to manually add Grant_priv to the administrative users. See the MySQL administration documentation.


    The following is an example for a MySQL 4.x or 5.0.x instance.

    # mysql -S /tmp/hahostix1.sock -uroot -p'adminpassword'
    mysql> use mysql;
    mysql> UPDATE user SET Grant_priv='Y' WHERE User='root' AND Host='zone1';
    mysql> UPDATE user SET Grant_priv='Y' WHERE User='root' AND Host='zone2';
    mysql> exit;

    Note - If you experience any problems here, refer to the MySQL administration documentation.


  6. Copy the MySQL configuration file to your home directory.
    # cp /opt/SUNWscmys/util/mysql_config /home-dir
  7. Create a fault-monitor user and a test database for the MySQL instance.
    # cd home-dir

    Edit the mysql_config file and follow the comments within that file.

    # Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
    #
    #
    #ident  "@(#)mysql_config.ksh   1.11    12/08/20"
    # 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 (Default is root)
    MYSQL_USER=
    
    # Password for MySQL admin user, if you do not want to disclose this password in
    # a file, leave the MYSQL_PASSWD variable empty, or take it out.
    MYSQL_PASSWD=
    
    # Configured logicalhost
    MYSQL_HOST=
    
    # Specify a username for a faultmonitor user
    FMUSER=
    
    # Pick a password for that faultmonitor user, if you do not want to disclose this
    # password in a file, leave the FMPASS variable empty, or take it out.
    FMPASS=
    
    # Socket name for mysqld ( Should be /tmp/<logical-host>.sock )
    MYSQL_SOCK=
    
    # Specify the physical hostname for the physical NIC that this
    # logical hostname
    
    # belongs to for every node in the cluster this resource group can be
    # 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-hme0 and
    # for hme3 on phys-2 it is phys-2-hme3.
    # IE: MYSQL_NIC_HOSTNAME="phys-1-hme0 phys-2-hme3"
    
    MYSQL_NIC_HOSTNAME=
    
    # Where are your databases installed? (location of my.cnf)
    
    MYSQL_DATADIR=

    The following is an example for a MySQL instance.

    MYSQL_BASE=/global/mysql
    MYSQL_USER=root
    MYSQL_PASSWD=
    MYSQL_HOST=hahostix1
    FMUSER=fmuser
    FMPASS=
    MYSQL_SOCK=/tmp/hahostix1.sock
    MYSQL_NIC_HOSTNAME="zone1 zone2"
    MYSQL_DATADIR=/global/mysql-data

    After editing mysql_config, you must run the mysql_register script.

    # /opt/SUNWscmys/util//mysql_register -f home-dir/mysql_config
  8. Stop the MySQL server instance manually.
    # kill -TERM `cat MySQL-Database-directory/mysqld.pid
  9. Leave the zone.
  10. Become superuser or assume a role that provides solaris.cluster.admin RBAC authorization in the global zone of the cluster node that hosts MySQL.
  11. Copy the MySQL configuration file to your home directory.
    # cp /opt/SUNWscmys/util/ha_mysql_config /home-dir
  12. Create and register MySQL as a failover data service.
    1. Navigate to the home-dir directory.
      # cd home-dir
    2. Edit the ha_mysql_config file and follow the comments within that file.
      #
      # CDDL HEADER START
      #
      # The contents of this file are subject to the terms of the
      # Common Development and Distribution License (the License).
      # You may not use this file except in compliance with the License.
      #
      # You can obtain a copy of the license at usr/src/CDDL.txt
      # or http://www.opensolaris.org/os/licensing.
      # See the License for the specific language governing permissions
      # and limitations under the License.
      #
      # When distributing Covered Code, include this CDDL HEADER in each
      # file and include the License file at usr/src/CDDL.txt.
      # If applicable, add the following below this CDDL HEADER, with the
      # fields enclosed by brackets [] replaced with your own identifying
      # information: Portions Copyright [yyyy] [name of copyright owner]
      #
      # CDDL HEADER END
      #
      
      #
      # Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
      #
      
      #ident  "@(#)ha_mysql_config.ksh     1.9    12/08/20"
      
      # 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
      #  SCALABLE - flag to indicate a sclable resource creation.
      #             The default is no, so any enty here triggers a scalable resource.
      # LB_POLICY - Set the loadbalancing policy for a scalable mysql service.
      #             Use the values defined for the standard resource property
      #             Load_balancing_policy. If you do not specify it, the defaults are 
      #             used.
      #   RS_PROP - Additional resource properties in the format for clresource create, 
      #             example "-p start_timeout=600"
      #
      #        To have the mysql agent local zone aware, 4 Variables are needed:
      #      ZONE - the zone name where the Mysql Database should run in
      #             Optional
      #    ZONEBT - The resource name which controls the zone. 
      #             Optional
      #   PROJECT - A project in the zone, that will be used for this service
      #             specify it if you have an su - in the start stop or probe,
      #             or to define the smf credentials. If the variable is not set,
      #             it will be translated as :default for the sm and default 
      #             for the zsh component
      #             Optional
      #     ZUSER - A user in the the zone which is used for the smf method 
      #             credentials. Your smf service will run under this user
      #             Optional
      #
      # Mysql specific Variables
      ##   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
      # MYSQLHOST - name of the host in /etc/hosts. For scalable/multiple master resources leave it empty 
      #    FMUSER - name of the Mysql fault monitor user
      #    FMPASS - name of the Mysql fault monitor user password
      #             If you do not want to store the password as readable in a file, leave the FMPASS variable 
      #             empty. 
      #    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
      # NDB_CHECK - Is MySQL Cluster installed?
      #             Any entry here triggers the ndb engine check, if no MySQL cluster should be checked 
      #             leave it empty.
      #

      The following is an example for a MySQL instance.

      RS=mysql-res
      RG=mysql-rg
      BASEDIR=/global/mysql
      DATADIR=/global/mysql-data
      MYSQLUSER=mysql
      LH=hahostix1
      MYSQLHOST=hahostix1
      FMUSER=fmuser
      FMPASS=
      LOGDIR=/global/mysql-data/logs
      CHECK=YES 
      HAS_RS=mysql-has-res
      ZONE=
      ZONE_BT=
      PROJECT=
    3. (Optional) If you did not specify the FMPASS variable, call the following script in all zones that can host the MySQL database.
      # /opt/SUNWscmys/util/ha_mysql_register -f home-dir/ha_mysql_config -e
    4. Register the MySQL resource.
      # /opt/SUNWscmys/util/ha_mysql_register -f home-dir/ha_mysql_config
  13. Enable each MySQL resource.

    Repeat this step for each MySQL instance, if multiple instances were created.

    # clresource status
    # clresource enable MySQL-resource

How to Register and Configure HA for MySQL as a Failover Service in an HA Container Configuration

This procedure assumes that you installed the data service packages during your initial Oracle Solaris Cluster installation.

If you did not install the HA for MySQL packages as part of your initial Oracle Solaris Cluster installation, go to Installing the HA for MySQL Packages.

  1. Log in to the zone on the node that hosts your MySQL resource-group.
  2. Become superuser or assume a role that provides solaris.cluster.admin RBAC authorization on the node's zone in the cluster that hostsMySQL.
  3. Start the MySQL server instance manually.
    # cd MySQL-base-directory
    # ./bin/mysqld --defaults-file=MySQLDatabasedirectory/my.cnf \
    --basedir=MySQL-Base-directory \
     --datadir=MySQL-Database-directory \
     --user=mysql \
     --pid-file=MySQL-Database-directory/mysqld.pid &
  4. Configure the administrator password for the administrative user.
    # MySQL-Database-directory/bin/mysqladmin \
    -S /tmp/logical-host.sock password 'admin password'
  5. Add the administrative user for locally accessing a MySQL instance with a MySQL logical-host-ip-name.

    Note - If you want to access the MySQL instance only through the socket (localhost), omit this step.


    When bootstrapping MySQL the command mysql_install_db creates two administrative users, one belonging to localhost and one belonging to the node on which mysql_install_db was executed.

    Add an administrative user for every global-cluster node that runs this MySQL instance.


    Note - If the node name and the hostname for the physical interface are different, use the hostname for the physical interface.


    The following is an example for a MySQL instance.

    # mysql -S /tmp/hahostix1.sock -uroot -p'admin-password'
    mysql> use mysql;
    mysql> GRANT ALL ON *.* TO 'root'@'zone1' IDENTIFIED BY 'rootpasswd';
    mysql> exit;

    Note - You have to manually add Grant_priv to the administrative users. See the MySQL administration documentation.


    The following is an example for a MySQL 4.x or 5.0.x instance.

    # mysql -S /tmp/hahostix1.sock -uroot -p'admin-password'
    mysql> use mysql;
    mysql> UPDATE user SET Grant_priv='Y' WHERE User'root' AND Host='zone';
    mysql> exit;

    Note - If you experience any problems here, refer to the MySQL administration documentation.


  6. Copy the MySQL configuration file to your home directory.
    # cp /opt/SUNWscmys/util/mysql_config /home-dir
  7. Create a fault-monitor user and a test database for the MySQL instance.
    1. Navigate to the home-dir directory.
      # cd home-dir
    2. Edit the mysql_config file and follow the comments within that file.
      #
      # Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
      #
      #
      
      #ident  "@(#)mysql_config.ksh   1.11    12/08/20"
      # 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 (Default is root)
      MYSQL_USER=
      
      # Password for MySQL admin user, if you do not want to disclose this password in 
      # a file, leave the MYSQL_PASSWD variable empty, or take it out.
      MYSQL_PASSWD=
      
      # Configured logicalhost
      MYSQL_HOST=
      
      # Specify a username for a faultmonitor user
      FMUSER=
      
      # Pick a password for that faultmonitor user, if you do not want to disclose this
      # password in a file, leave the FMPASS variable empty, or take it out.
      FMPASS=
      
      # Socket name for mysqld ( Should be /tmp/<logical-host>.sock )
      MYSQL_SOCK=
      
      # Specify the physical hostname for the physical NIC that this
      # logical hostname
      
      # belongs to for every node in the cluster this resource group can be
      # 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-hme0 and
      # for hme3 on phys-2 it is phys-2-hme3.
      # IE: MYSQL_NIC_HOSTNAME="phys-1-hme0 phys-2-hme3"
      
      MYSQL_NIC_HOSTNAME=
      
      
      # Where are your databases installed? (location of my.cnf)
      
      MYSQL_DATADIR=

      The following is an example for a MySQL instance.

      MYSQL_BASE=/global/mysql
      MYSQL_USER=root
      MYSQL_PASSWD=
      MYSQL_HOST=hahostix1
      FMUSER=fmuser
      FMPASS=
      MYSQL_SOCK=/tmp/hahostix1.sock
      MYSQL_NIC_HOSTNAME="zone1"
      MYSQL_DATADIR=/global/mysql-data
    3. After editing mysql_config, you must run the mysql_register script.
      # /opt/SUNWscmys/util//mysql_register -f home-dir/mysql_config
  8. Stop the MySQL server instance manually.
    # kill -TERM `cat MySQL-Database-directry/mysqld.pid
  9. Leave the zone.
  10. Become superuser or assume a role that provides solaris.cluster.admin RBAC authorization in the global zone of the cluster node that hosts MySQL.
  11. Copy the MySQL configuration file to your home directory.
    # cp /opt/SUNWscmys/util/ha_mysql_config /home-dir
  12. Create and register MySQL as a failover data service.
    1. Navigate to home-dir directory.
      # cd home-dir
    2. Edit the ha_mysql_config file and follow the comments within that file.
      #
      # CDDL HEADER START
      #
      # The contents of this file are subject to the terms of the
      # Common Development and Distribution License (the License).
      # You may not use this file except in compliance with the License.
      #
      # You can obtain a copy of the license at usr/src/CDDL.txt
      # or http://www.opensolaris.org/os/licensing.
      # See the License for the specific language governing permissions
      # and limitations under the License.
      #
      # When distributing Covered Code, include this CDDL HEADER in each
      # file and include the License file at usr/src/CDDL.txt.
      # If applicable, add the following below this CDDL HEADER, with the
      # fields enclosed by brackets [] replaced with your own identifying
      # information: Portions Copyright [yyyy] [name of copyright owner]
      #
      # CDDL HEADER END
      #
      
      #
      # Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
      #
      
      #ident  "@(#)ha_mysql_config.ksh        1.9     12/08/20"
      
      # 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
      #  SCALABLE - flag to indicate a sclable resource creation.
      #             The default is no, so any enty here triggers a scalable resource.
      # LB_POLICY - Set the loadbalancing policy for a scalable mysql service.
      #             Use the values defined for the standard resource property
      #             Load_balancing_policy. If you do not specify it, the defaults are 
      #             used.
      #   RS_PROP - Additional resource properties in the format for clresource create, 
      #             example "-p start_timeout=600"
      #
      #        To have the mysql agent local zone aware, 4 Variables are needed:
      #      ZONE - the zone name where the Mysql Database should run in
      #             Optional
      #    ZONEBT - The resource name which controls the zone. 
      #             Optional
      #   PROJECT - A project in the zone, that will be used for this service
      #             specify it if you have an su - in the start stop or probe,
      #             or to define the smf credentials. If the variable is not set,
      #             it will be translated as :default for the sm and default 
      #             for the zsh component
      #             Optional
      #     ZUSER - A user in the the zone which is used for the smf method 
      #             credentials. Your smf service will run under this user
      #             Optional
      #
      # Mysql specific Variables
      #
      #   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
      # MYSQLHOST - name of the host in /etc/hosts. For scalable/multiple master resources leave it empty 
      #    FMUSER - name of the Mysql fault monitor user
      #    FMPASS - name of the Mysql fault monitor user password
      #             If you do not want to store the password as readable in a file, leave the FMPASS variable 
      #             empty. 
      #    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
      # NDB_CHECK - Is MySQL Cluster installed?
      #             Any entry here triggers the ndb engine check, if no MySQL cluster should be checked 
      #             leave it empty.
      #

      The following is an example for a MySQL instance.

      RS=mysql-res
      RG=mysql-rg
      BASEDIR=/global/mysql
      DATADIR=/global/mysql-data
      MYSQLUSER=mysql
      LH=hahostix1
      MYSQLHOST=hahostix1
      FMUSER=fmuser
      FMPASS=
      LOGDIR=/global/mysql-data/logs
      CHECK=YES 
      HAS_RS=mysql-has-res
      ZONE=zone1
      ZONE_BT=zone1-rs
      PROJECT=MySQL-project
    3. (Optional) If you did not specify the FMPASS variable, make the ha_mysql_config file available in the zone and call the following script in the zone that can host the MySQL database.
      # /opt/SUNWscmys/util/ha_mysql_register -f home-dir/ha_mysql_config -e
    4. Register the MySQL resource.
      # /opt/SUNWscmys/util/ha_mysql_register -f home-dir/ha_mysql_config
  13. Enable each MySQL resource.

    Repeat this step for each MySQL instance, if multiple instances were created.

    # clresource status
    # clresource enable MySQL-resource

How to Modify Parameters in the HA for MySQL Manifest

Perform this task to change parameters in the HA for MySQL manifest and to validate the parameters in the HA container. Parameters for the HA for MySQL manifest are stored as properties of the SMF service. To modify parameters in the manifest, change the related properties in the SMF service then validate the parameter changes.

  1. Become superuser or assume a role that provides solaris.cluster.modify and solaris.cluster.admin RBAC authorizations on the zones console.
  2. Change the Solaris Service Management Facility (SMF) properties for the HA for MySQL manifest.
    # svccfg svc:/application/sczone-agents:resource

    For more information, see the svccfg(1M) man page.

  3. Validate the parameter changes.
    # /opt/SUNWscmys/bin/control_mysql validate resource

    Messages for this command are stored in the /var/adm/messages/ directory of the HA container.

  4. Disconnect from the HA container's console.

How to Remove an HA for MySQL Resource From an HA Container

  1. Become superuser or assume a role that provides solaris.cluster.modify and solaris.cluster.admin RBAC authorizations.
  2. Disable and remove the resource that is used by the HA for MySQL data service.
    # clresource disable resource
    # clresource delete resource
  3. Log in as superuser to the HA container's console.
  4. Unregister HA for MySQL from the Solaris Service Management Facility (SMF) service.
    # /opt/SUNWscmys/util/ha_mysql_smf_remove -f filename
    -f

    Specifies the configuration file name.

    filename

    The name of the configuration file that you used to register HA for MySQL with the SMF service.


    Note - If you no longer have the configuration file that you used to register HA for MySQL with the SMF service, create a replacement configuration file:

    1. Make a copy of the default file, /opt/SUNWscmys/util/ha_mysql_config.

    2. Set the ZONE and RS parameters with the values that are used by the data service.

    3. Run the ha_mysql_smf_remove command and use the -f option to specify this configuration file.


  5. Disconnect from the HA container's console.

How to Add an HA for MySQL Resource in a Scalable or Multiple-Master Configuration

Before You Begin

Ensure that you installed the data service packages during your initial Oracle Solaris Cluster installation. If you did not install the HA for MySQL packages as part of your initial Oracle Solaris Cluster installation, go to Installing the HA for MySQL Packages.


Note - Perform the following steps, including stopping the MySQL server on every node or zone that hosts the MySQL server.


  1. (Optional) Log in to the target zone.
    # zlogin zone-name

    Note - If you install MySQL in a zone cluster, you are in the target zone already.


  2. Become superuser or assume a role that provides solaris.cluster.admin RBAC authorization on the cluster node that hosts MySQL.
  3. Start the MySQL Server instance manually.
    # cd MySQL-Base-directory
    # ./bin/mysqld --defaults-file=MySQL-Database-directry/my.cnf \
    --basedir=MySQL-Base-directory \
    --datadir=MySQL-Database-directory --user=mysql \
    --pid-file=MySQL-Database-directory/mysqld.pid &
  4. Configure the administrator password for the administrative user.
    # MySQL-Database-directory/bin/mysqladmin \
    -S /tmp/Logicalhost.sock password 'admin password'
  5. Add the administrative user for locally accessing a MySQL instance with a MySQL-logical-host-ip-name.

    Note - If you want to access the MySQL instance only through the socket (localhost), omit this step. When bootstrapping MySQL, the command mysql_install_db creates two administrative users, one belonging to localhost and one belonging to the node on which mysql_install_db was executed.


    Add an administrative user for every global-cluster node that runs this MySQL instance.


    Note - If the node name and the hostname for the physical interface are different, use the hostname for the physical interface.


    The following is an example for a MySQL instance.

    # mysql -S /tmp/clusterix2.sock -uroot -p'admin-password'
    mysql> use mysql;
    mysql> GRANT ALL ON *.* TO 'root'@'clusterix2' IDENTIFIED BY 'rootpasswd';
    mysql> UPDATE user SET Grant_priv='Y' WHERE User='root' AND Host='clusterix2';
    mysql> exit;

    Note - If you experience any problems here, refer to the Link: MySQL administration documentation.


  6. Copy the MySQL configuration files to your home directory.
    # cp /opt/SUNWscmys/util/ha_mysql_config /home-dir 
    # cp /opt/SUNWscmys/util/mysql_config /home-dir
  7. Create a fault-monitor user and a test database for the MySQL instance.
    # cd home-dir
  8. Edit the mysql_config file and follow the comments within that file.
    ##
    CDDL HEADER START
    ##
    #The contents of this file are subject to the terms of the
    # Common Development and Distribution License (the License).
    # You may not use this file except in compliance with the License.
    ##
    #You can obtain a copy of the license at usr/src/CDDL.txt
    # or http://www.opensolaris.org/os/licensing.
    # See the License for the specific language governing permissions
    # and limitations under the License.
    ##
    #When distributing Covered Code, include this CDDL HEADER in each
    # file and include the License file at usr/src/CDDL.txt.
    # If applicable, add the following below this CDDL HEADER, with the
    # fields enclosed by brackets [] replaced with your own identifying
    # information: Portions Copyright [yyyy] [name of copyright owner]
    ##
    CDDL HEADER END
    #
    ##
    #Copyright 2012 Oracle Corporation. All rights reserved.
    # Use is subject to license terms.
    #
    #ident "@(#)ds_template.sgm 1.42 13/01/24 SMI"
    # 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 (Default is root)
    MYSQL_USER=
    # Password for MySQL admin user
    MYSQL_PASSWD=
    # Configured logicalhost. For scalable or multiple-master resources leave it empty.
    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=
    # Specify the physical hostname for the physical NIC that this logicalhostname
    # belongs to for every node in the cluster this resource group can be located on.
    # If you use the mysql_geocontrol features to implement the MySQL replication as
    # the replication protocol in Oracle Solaris Cluster geographic edition, specify all
    # physical nodes of all clusters. Specify at least all the nodes on both sites
    # where the MySQL databases can be hosted.
    # 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-hme0 and
    # for hme3 on phys-2 it is phys-2-hme3.
    # IE: MYSQL_NIC_HOSTNAME="phys-1-hme0 phys-2-hme3"
    # IE: If two clusters are tied together by the mysql_geocontrol features, assuming the
    # MySQL database on cluster one belongs to cl1-phys1-hme0 and cl1-phys2-hme3, the
    # MySQL database on cluster two belongs to cl2-phys1-hme2 and cl2-phys2-hme4. Then the
    # MYSQL_NIC_HOSTNAME variable needs to be set to:
    # MYSQL_NIC_HOSTNAME="cl1-phys1-hme0 cl1-phys2-hme3 cl2-phys1-hme2 cl2-phys2-
    #hme4"
    MYSQL_NIC_HOSTNAME=
    # Where are your databases installed, (location of my.cnf)
    MYSQL_DATADIR=
    # Is MySQL Cluster installed?
    # Any entry here triggers the ndb engine check preparation. If no MySQL cluster should be
    # checked, leave it empty.
    NDB_CHECK=

    The following is an example for a MySQL instance.

    MYSQL_BASE=/global/mysql
    MYSQL_USER=root
    MYSQL_PASSWD=
    MYSQL_HOST=hahostix1
    FMUSER=fmuser
    FMPASS=
    MYSQL_SOCK=/tmp/hahostix1.sock
    MYSQL_NIC_HOSTNAME="clusterix1 clusterix2"
    MYSQL_DATADIR=/global/mysql-data
    NDB_CHECK=

    If you want to monitor the ndb tables of a MySQL cluster, set NDB_CHECK to yes.

    If you are about to prepare the database servers for a scalable or multiple-master configuration, set MYSQL_SOCK=hostname.sock.

  9. After editing mysql_config, run the mysql_register script.
    # /opt/SUNWscmys/util//mysql_register -f home-dir/mysql_config
  10. Stop the MySQL Server instance manually.
    # kill -TERM 'cat MySQL-Database-directry/mysqld.pid
  11. After finishing the previous steps on every node or zone in the cluster, continue in the global zone unless you configure the MySQL server resource in a zone cluster.
  12. Create and register MySQL as a scalable or multiple-master data service.
    1. Navigate to the home-dir directory.
      # cd home-dir
    2. Edit the ha_mysql_config file and follow the comments within that file.
      ##
      CDDL HEADER START
      ##
      #The contents of this file are subject to the terms of the
      # Common Development and Distribution License (the License).
      # You may not use this file except in compliance with the License.
      ##
      #You can obtain a copy of the license at usr/src/CDDL.txt
      # or http://www.opensolaris.org/os/licensing.
      # See the License for the specific language governing permissions
      # and limitations under the License.
      ##
      #When distributing Covered Code, include this CDDL HEADER in each
      # file and include the License file at usr/src/CDDL.txt.
      # If applicable, add the following below this CDDL HEADER, with the
      # fields enclosed by brackets [] replaced with your own identifying
      # information: Portions Copyright [yyyy] [name of copyright owner]
      ##
      CDDL HEADER END
      #
      ##
      #
      # Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
      #
      
      #ident  "@(#)ha_mysql_config.ksh        1.9     12/08/20"
      ##
      # 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
      # SCALABLE - flag to indicate a sclable resource creation.
      # The default is no, so any entry here triggers a scalable resource.
      # LB_POLICY - Set the loadbalancing policy for a scalable MySQL service.
      # Use the values defined for the standard resource property
      # Load_balancing_policy. If you do not specify it, the defaults are
      # used.
      # RS_PROP - Additional resource properties in the format for clresource create.
      # Example: "-p start_timeout=600"
      ##
      # To have the MySQL agent local zone aware, 4 variables are needed:
      # ZONE - The zone name where the MySQL Database should run.
      # Optional
      # ZONEBT - The resource name which controls the zone. 
      # Optional
      # PROJECT - A project in the zone that will be used for this service.
      # Specify it if you have an su - in the start stop or probe,
      # or to define the smf credentials. If the variable is not set,
      # it will be translated as :default for the sm and default
      # for the zsh component.
      # Optional
      # ZUSER - A user in the the zone which is used for the smf method
      # credentials. Your smf service will run under this user.
      # Optional
      ##
      MySQL specific variables
      ##
      # BASEDIR - name of the MySQL bin directory
      # DATADIR - name of the MySQL Data directory
      # MYSQLUSER - name of the user MySQL should be started with or from
      # LH - name of the LogicalHostname SC resource
      # MYSQLHOST - name of the host in /etc/hosts. For scalable/multiple-master resources, leave it
      # empty.
      # FMUSER - name of the MySQL fault monitor user
      # FMPASS - name of the MySQL fault monitor user password
      # If you do not want to store the password as readable in a file, leave the FMPASS
      # variable empty.
      # LOGDIR - name of the directory where mysqld should store its logfile.
      # CHECK - should HA-MySQL check MyISAM index files before start YES/NO.
      # HAS_RS - name of the MySQL HAStoragePlus SC resource
      # NDB_CHECK - Is MySQL Cluster installed?
      # Any entry here triggers the ndb engine check, if no MySQL cluster should be checked
      # leave it empty.
      ##
      #The following examples illustrate sample parameters
      # for MySQL
      ##
      # BASEDIR=/usr/local/mysql
      # DATADIR=/global/mysqldata
      # MYSQLUSER=mysql
      # LH=mysqllh
      # RS_PROP=
      # SCALABLE=
      # LB_POLICY=
      # MYSQLHOST=mysqllh
      # FMUSER=fmuser
      # FMPASS=
      # LOGDIR=/global/mysqldata/logs
      # CHECK=YES
      # NDB_CHECK=
      #
      RS=
      RG=
      PORT=
      LH=
      SCALABLE=
      LB_POLICY=
      HAS_RS=
      # local zone specific options
      ZONE=
      ZONE_BT=
      PROJECT=
      # mysql specifications
      BASEDIR=
      DATADIR=
      MYSQLUSER=
      MYSQLHOST=
      FMUSER=
      FMPASS=
      LOGDIR=
      CHECK=
      NDB_CHECK=

      The following is an example for a MySQL instance.


      Note - If you want to register a multiple-master resource, do not set the variables SCALABLE and MYSQLHOST.

      SCALABLE= 
      MYSQLHOST=
      RS=mysql-res
      RG=mysql-rg
      BASEDIR=/global/mysql
      DATADIR=/global/mysql-data
      MYSQLUSER=mysql
      LH=hahostix1
      SCALABLE=yes
      LB_POLICY=
      RS_PROP=
      MYSQLHOST=hahostix1
      FMUSER=fmuser
      FMPASS=
      LOGDIR=/global/mysql-data/logs
      CHECK=YES
      NDB_CHECK=
      HAS_RS=
      ZONE=
      ZONE_BT=
      PROJECT=

      If you want to monitor the ndb tables of a MySQL cluster, set NDB_CHECK to yes.


    3. (Optional) If you did not specify the FMPASS variable, make the ha_mysql_config file available in all hosts or zones and call the following script in all hosts or zones that can host the MySQL database.
      # /opt/SUNWscmys/util/ha_mysql_register -f home-dir/ha_mysql_config -e
    4. Register the MySQL resource.
      # /opt/SUNWscmys/util/ha_mysql_register -f home-dir/ha_mysql_config
  13. Switch the resource group to a managed online state.
    # clresourcegroup online -M MySQL-Scalable-resource-group