Go to main content

Oracle® Solaris Cluster Data Service for MySQL Guide

Exit Print View

Updated: June 2017
 
 

Example: Enabling the MySQL Software to Run in the Cluster

  1. Start the MySQL database manually on the node where the resource group is online.
    zone# cd /usr/local/mysql
    zone# ./bin/mysqld --defaults-file=/global/mnt3/mysql-data/my.cnf \
    --basedir=/usr/local/mysql --datadir=/global/mnt3/mysql-data \
    --pid-file=/global/mnt3/mysql-data/mysqld.pid \
    --user=mysql >> /global/mnt3/mysql-data/logs/ha-host-1.log 2>&1 &
  2. Set the password for localhost in MySQL to root.
    zone# /usr/local/mysql/bin/mysqladmin -S /tmp/ha-host-1.sock -uroot \
    password 'root'
  3. Add an administrative user in the MySQL database for the logical host.
    zone# /usr/local/mysql/bin/mysql -S /tmp/ha-host-1.sock -uroot -proot
    mysql> use mysql;
    mysql> GRANT ALL ON *.* TO 'root'@'ha-host-1' IDENTIFIED BY 'root';
    mysql> UPDATE user SET Grant_priv='Y' WHERE User='root' AND Host='ha-host-1';
    mysql> exit
  4. Prepare the Oracle Solaris Cluster specific test database.
    zone# ksh /opt/SUNWscmys/util/mysql_register -f /config-files/mysql_config
    1. Enter root after you are prompted for the MySQL administrative password.

      You set this to root in Step 3.

    2. Enter a password when you are prompted for the fault monitor user password.
  5. Stop the MySQL database.
    zone# kill -TERM `cat /global/mnt3/mysql-data/mysqld.pid`
  6. Leave the zone.
  7. Copy the MySQL database configuration file from the agent directory to its deployment location.
    phys-schost-1# cp /opt/SUNWscmys/util/ha_mysql_config /global/mnt3
  8. Add this cluster's information to the ha_mysql_config configuration file.

    The following listing shows the relevant file entries and the values to assign to each entry.

    RS=RS-MYS
    RG=RG-MYS
    PORT=5432
    LH=ha-host-1
    LB_POLICY=
    SCALABLE=
    HAS_RS=RS-MYS-HASZONE=clu1
    ZONE_BT=RS-MYS-ZONE
    PROJECT=BASEDIR=/usr/local/mysql
    DATADIR=/global/mnt3/mysql-data
    MYSQLUSER=mysql
    MYSQLHOST=ha-host-1
    FMUSER=fmuser
    FMPASS=
    LOGDIR=/global/mnt3/mys-data/logs
    CHECK=YES
    NDB_CHECK=
  9. Save and close the file.
  10. Make the /global/mnt3/ha_mysql_config file available on the zone to run the MySQL database.
  11. Enter the zone.
  12. Encrypt the fault monitor user password on one node to run the MySQL database.
    zone# ksh /opt/SUNWscmys/util/ha_mysql_register \
    -f /global/mnt3/ha_mysql_config -e

    Enter the same password you provided in Step 4 when you are prompted for the fault monitoring user password.

  13. Leave the zone.
  14. Run the ha_mysql_register script to register the resource.
    phys-schost-1# ksh /opt/SUNWscmys/util/ha_mysql_register \
    -f /global/mnt3/ha_mysql_config
  15. Enable the resource.
    phys-schost-1# clresource enable RS-MYS