This section contains the procedures you need to install and configure MySQL.
References will be made to certain directories for MySQL. The following list shows common path names for these references. For more information, refer to the Configuration Restrictions section.
MySQL installed from http://www.mysql.com on a Global File System, with a MySQL instance on a Global File System (Example 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 2)
MySQL Basedirectory— /usr/local/mysql
MySQL Database directory — /local/mysqldata
Determine how MySQL will be deployed in Sun Cluster
Determine how many MySQL instances will be deployed.
Determine which Cluster File System will be used by each MySQL instance.
Determine the type of the target zone where you will install MySQL. Valid zone types are, the global zone, the failover zone, or a zone.
To install and configure MySQL in a global zone configuration, complete the following tasks:
To install and configure MySQL in a zone configuration, complete the following tasks:
To install and configure MySQL in a failover zone configuration, complete the following tasks:
You will find installation examples for each zone type in:
Appendix A, Deployment Example: Installing MySQL in the Global Zone
Appendix B, Deployment Example: Installing MySQL in the Non — Global Failover Zone
Appendix C, Deployment Example: Installing MySQL in a Non-Global Zone
Become superuser or assume a role that provides solaris.cluster.verb RBAC authorization on one of the nodes in the cluster that will host MySQL.
Register the SUNW.gds and SUNW.HAStoragePlus resource type.
# clresourcetype register SUNW.gds SUNW.HAStoragePlus |
Create a failover resource group.
# clresourcegroup create MySQL-failover-resource-group |
Create a resource for the MySQL Disk Storage.
# clresource create \ -g MySQL-failover-resource-group \ -t SUNW.HAStoragePlus \ -p FilesystemMountPoints=MySQL-instance-mount-points MySQL-has-resource |
Create a resource for the MySQL Logical Hostname.
# clreslogicalhostname \ -g MySQL-failover-resource-group \ -h MySQL-logical-hostname \ MySQL-lh-resource |
Enable the failover resource group that now includes the MySQL Disk Storage and Logical Hostname resources.
# clresourcegroup online -M -n current-node MySQL-failover-resource-group |
Insure that you are on the node where your enabled your resource group.
Install MySQL onto all nodes within Sun Cluster.
It is recommended that MySQL be installed onto a Global File System. 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, 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.
Create an entry in /etc/group on all nodes with Sun Cluster.
# groupadd -g 1000 mysql |
Create an entry in /etc/passwd on all nodes within Sun Cluster. This user should have a locked password.
# useradd -u 1000 -g 1000 -d /global/mysql -s /bin/sh mysql |
Change owner and group for MySQL binaries.
If MySQL binaries are on all nodes then repeat this step on every node.
# chown -R mysql:mysql /global/mysql |
Create your MySQL Database directory for your MySQL Instance or Instances.
# mkdir MySQL Database directory |
Refer to the Configuration Restrictions section for a description of the MySQL Database directory and to the Installing and Configuring MySQL section for a list of common path names.
The following listing 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 sample 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, proceed to Installing the Sun Cluster HA for MySQL Packages to install it on your cluster. Return here to continue the Installation and Configuration of MySQL.
The contents of /opt/SUNWscmys/etc/my.cnf_sample_[master|slave]provide a sample MySQL configuration file that you can use to create your MySQL instance MySQL Databasedirectory/my.cnf. You must still edit that file to reflect your configuration values.
# cp /opt/SUNWscmys/etc/my.cnf_sample_master \ MySQL Database directory/my.cnf |
Bootstrap MySQL instance — This creates the privilege tables db, host, user, tables_priv and columns_priv in the mysql database, as well as the func table.
# cd MySQL Base directory |
# ./scripts/mysql_install_db \ --datadir=MySQL Database directory |
Create a logfile directory in MySQL Database Directory.
# mkdir MySQL Database Directory/logs |
Create directories for your storage engines.
# mkdir MySQL Database Directory/innodb # mkdir MySQL Database Directory/BDB |
Change owner and group for MySQL Database Directory.
# chown -R mysql:mysql MySQL Database Directory |
Change file permission for MySQL Database Directory/my.cnf.
# chmod 644 <MySQL Database Directory>/my.cnf |
Become superuser or assume a role that provides solaris.cluster.verb RBAC authorization on one of the nodes in the cluster that will host MySQL.
Create and boot your zone MySQL-zone on all the nodes to host your MySQL data base.
Register the SUNW.gds and SUNW.HAStoragePlus resource type.
# clresourcetype register SUNW.gds SUNW.HAStoragePlus |
Create a failover resource group.
# clresourcegroup create \ -n node1:MySQL-zone,node2:MySQL-zone \ MySQL-failover-resource-group |
Create a resource for the MySQL Disk Storage.
# clresource create \ -g MySQL-failover-resource-group \ -t SUNW.HAStoragePlus \ -p FilesystemMountPoints=MySQL-instance-mount-points MySQL-has-resource |
Create a resource for the MySQL Logical Hostname.
# clreslogicalhostname \ -g MySQL-failover-resource-group \ -h MySQL-logical-hostname \ MySQL-lh-resource |
Enable the failover resource group that now includes the MySQL Disk Storage and Logical Hostname resources.
# clresourcegroup online -M -n current-node MySQL-failover-resource-group |
Insure that you are on the node where your enabled your resource group.
Log in to your zone.
# zlogin MySQL-zone |
Become superuser or assume a role that provides solaris.cluster.verb RBAC authorization on one of the nodes in the cluster that will host MySQL.
Install MySQL onto all nodes within Sun Cluster.
It is recommended that MySQL be installed onto a Global File System. 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, 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:zones in the cluster that will run MySQL.
Create an entry in /etc/group on all nodes with Sun Cluster.
# groupadd -g 1000 mysql |
Create an entry in /etc/passwd on all nodes within Sun Cluster. This user should have a locked password.
# useradd -u 1000 -g 1000 -d /global/mysql -s /bin/sh mysql |
Change owner and group for MySQL binaries.
If MySQL binaries are on all nodes then repeat this step on every node.
# chown -R mysql:mysql /global/mysql |
Create your MySQL Database directory for your MySQL Instance or Instances.
# mkdir <MySQL Database directory> |
Refer to the Configuration Restrictions section for a description of the MySQL Database directory and to the Installing and Configuring MySQL section for a list of common path names.
The following listing 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 sample 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, proceed to Installing the Sun Cluster HA for MySQL Packages to install it on your cluster. Return here to continue the Installation and Configuration of MySQL.
The contents of /opt/SUNWscmys/etc/my.cnf_sample_[master|slave]provide a sample MySQL configuration file that you can use to create your MySQL instance MySQL Databasedirectory/my.cnf. You must still edit that file to reflect your configuration values.
# cp /opt/SUNWscmys/etc/my.cnf_sample_master \ <MySQL Database directory>/my.cnf |
Bootstrap MySQL instance — This creates the privilege tables db, host, user, tables_priv and columns_priv in the mysql database, as well as the func table.
# cd <MySQL Base directory> |
# ./scripts/mysql_install_db \ --datadir=<MySQL Database directory> |
Create a logfile directory in MySQL Database Directory
# mkdir MySQL Database Directory/logs |
Create directories for your storage engines.
# mkdir <MySQL Database Directory>/innodb # mkdir <MySQL Database Directory>/BDB |
Change owner and group for <MySQL Database Directory>
# chown -R mysql:mysql <MySQL Database Directory> |
Change file permission for <MySQL Database Directory>/my.cnf
# chmod 644 <MySQL Database Directory>/my.cnf |
Become superuser or assume a role that provides solaris.cluster.verb RBAC authorization on one of the nodes in the cluster that will host MySQL.
As superuser register the SUNW.HAStoragePlus and the SUNW.gds resource types.
# clresourcetype register SUNW.HAStoragePlus SUNW.gds |
Create a failover resource group.
# clresourcegroup create MySQL-resource-group |
Create a resource for the MySQL zone`s disk storage.
# clresource create -t SUNW.HAStoragePlus \ -p FileSystemMountPoints=MySQL-instance-mount-points \ MySQL-has-resource |
(Optional) If you want the protection against a total adapter failure for your public network, create a resource for the MySQL`s logical hostname.
# clreslogicalhostname create -g MySQL-resource-group \ -h logical-hostname \ MySQL-logical-hostname-resource-name |
Place the resource group in the managed state.
# clresourcegroup online -M MySQL-resource-group |
Install the zone.
Install the zone according to the Sun Cluster HA for Solaris Containers agent documentation, assuming that the resource name is MySQL-zone-rs and that the zone name is MySQL-zone.
Verify the zone's installation.
# zoneadm -z MySQL-zone boot # zoneadm -z MySQL-zone halt |
Register the zone's boot component.
Copy the container resource boot component configuration file.
# cp /opt/SUNWsczone/sczbt/util/sczbt_config zones-target-configuration-file |
Use a plain text editor to set the following variables:
RS=MySQL-zone-rs RG=MySQL-resource-group PARAMETERDIR=MySQL-zone-parameter-directory SC_NETWORK=true|false SC_LH=MySQL-logical-hostname-resource-name FAILOVER=true|false HAS_RS=MySQL-has-resource Zonename=MySQL-zone Zonebootopt=zone-boot-options Milestone=zone-boot-milestone Mounts=
Create the parameter directory for your zone's resource.
# mkdir MySQL-zone-parameter-directory |
Execute the Sun Cluster HA for Solaris Container's registration script.
# /opt/SUNWsczone/sczbt/util/sczbt_register -f zones-target-configuration-file |
Enable the Solaris Container resource
# clresource enable MySQL-zone-rs |
# clresourcegroup online MySQL-resource-group |
Insure that you are on the node where your enabled your resource group.
Log in to your zone
# zlogin MySQL-zone |
Become superuser or assume a role that provides solaris.cluster.verb RBAC authorization on one of the nodes in the cluster that will host MySQL.
Install MySQL.
It is recommended that MySQL be installed onto a Global File System. 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 — 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 zone that will run MySQL.
Create an entry in /etc/group in the zone.
# groupadd -g 1000 mysql |
Create an entry in /etc/passwd on all nodes within Sun Cluster. This user should have a locked password.
# useradd -u 1000 -g 1000 -d /global/mysql -s /bin/sh mysql |
Change owner and group for MySQL binaries.
# chown -R mysql:mysql /global/mysql |
Create your MySQL Database directory for your MySQL Instance or Instances.
# mkdir MySQL Database directory |
Refer to the Configuration Restrictions section for a description of the MySQL Database directory and to the Installing and Configuring MySQL section for a list of common path names.
The following listing 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 sample 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, proceed to Installing the Sun Cluster HA for MySQL Packages to install it on your cluster. Return here to continue the Installation and Configuration of MySQL.
The contents of /opt/SUNWscmys/etc/my.cnf_sample_[master|slave]provide a sample MySQL configuration file that you can use to create your MySQL instance <MySQL Databasedirectory>/my.cnf. You must still edit that file to reflect your configuration values.
# cp /opt/SUNWscmys/etc/my.cnf_sample_master \ <MySQL Database directory>/my.cnf |
Bootstrap MySQL instance — This creates the privilege tables db, host, user, tables_priv and columns_priv in the mysql database, as well as the func table.
# cd <MySQL Base directory> |
# ./scripts/mysql_install_db \ --datadir=<MySQL Database directory> |
Create a logfile directory in MySQL Database Directory.
# mkdir MySQL Database Directory/logs |
Create directories for your storage engines.
# mkdir MySQL Database Directory/innodb # mkdir MySQL Database Directory/BDB |
Change owner and group for MySQL Database Directory.
# chown -R mysql:mysql MySQL Database Directory |
Change file permission for MySQL Database Directory/my.cnf.
# chmod 644 MySQL Database Directory/my.cnf |