Sun Cluster Data Service for MySQL Guide for Solaris OS

ProcedureHow to Install and Configure MySQL in a Failover Zone

  1. Insure that you are on the node where your enabled your resource group.

  2. Log in to your zone


    # zlogin MySQL-zone
    
  3. 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.

  4. 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.

  5. 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 
    
  6. Change owner and group for MySQL binaries.


    # chown -R mysql:mysql /global/mysql
    
  7. Create your MySQL Database directory for your MySQL Instance or Instances.


    # mkdir MySQL Database directory
    

    Note –

    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
    #
  8. 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.


    Note –

    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  
    
  9. 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>
    
  10. Create a logfile directory in MySQL Database Directory.


    # mkdir MySQL Database Directory/logs  
    
  11. Create directories for your storage engines.


    # mkdir MySQL Database Directory/innodb
    # mkdir MySQL Database Directory/BDB
    
  12. Change owner and group for MySQL Database Directory.


    # chown -R mysql:mysql MySQL Database Directory
    
  13. Change file permission for MySQL Database Directory/my.cnf.


    # chmod 644 MySQL Database Directory/my.cnf