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.
# 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 -uroot 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;
The following is an example for a MySQL 5.x 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;
The following is an example for a MySQL 8.x instance.
# mysql -S /tmp/clusterix2.sock -uroot -padmin-password mysql> use mysql; mysql> CREAT USER 'root'@'clusterix2' IDENTIFIED BY 'rootpasswd'; 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/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)
# clpstring create -t resource -b MySQL-resource MySQL-resource
To monitor the ndb tables, set the Mysql_cluster property to true.
# clresource create -d -g MySQL-failover-resource-group \ -t ORCL.mysql \ -p Mysql_basedir=MySQL-Base-directory \ -p Mysql_datadir=MySQL-database-directory \ -p Mysql_user=MySQL-OS-user \ -p Mysql_host=MySQL-scalable-address \ -p Mysql_fmuser=MySQL-database-fault-monitoring-user \ -p Mysql_logdir=MySQL-database-log-directory \ -p Scalable=true \ -p Port_list=mysql_port/tcp \ -p Resource_dependencies=MySQL-logical-host-resource \ -p Resource_dependencies_offline_restart=MySQL-storage-resource \ MySQL-resource
# clresourcegroup online -eM MySQL-Scalable-resource-group
The following example encrypts a password for the MySQL-resource resource, then creates and registers the scalable resource in the mysql-rg resource group.
# clpstring create -t resource -b MySQL-resource MySQL-resource # clresource create -d -g mysql-rg \ -t ORCL.mysql \ -p Mysql_basedir=/usr/local/mysql \ -p Mysql_datadir=/global/mysql-data \ -p Mysql_user=mysql \ -p Mysql_host=hahostix1 \ -p Mysql_fmuser=fmuser \ -p Mysql_logdir=/global/mysql-data/logs \ -p Scalable=true \ -p Port_list=3306/tcp \ -p Resource_dependencies=hahostix1 \ -p Resource_dependencies_offline_restart=mysql-has-res \ MySQL-resource