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 Package.
# zlogin zone-name
# 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 &
# MySQL-Database-directory/bin/mysqladmin \ -S /tmp/Logicalhost.sock password 'admin-password'
Add an administrative user for every global-cluster node that runs this MySQL instance.
The following is an example for a MySQL instance.
# mysql -S /tmp/clusterix2.sock -uroot -padmin-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;
# cp /opt/SUNWscmys/util/ha_mysql_config /home-dir # cp /opt/SUNWscmys/util/mysql_config /home-dir
# cd home-dir
## 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.41 12/10/12" # 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=root 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.
# /opt/SUNWscmys/util//mysql_register -f home-dir/mysql_config
# kill -TERM 'cat MySQL-Database-directory/mysqld.pid
# cd home-dir
## 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=fmuser # 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.
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.
# /opt/SUNWscmys/util/ha_mysql_register -f home-dir/ha_mysql_config -e
# /opt/SUNWscmys/util/ha_mysql_register -f home-dir/ha_mysql_config
# clresourcegroup online -M MySQL-Scalable-resource-group