Go to main content

Oracle® Solaris Cluster Data Service for MySQL Guide

Exit Print View

Updated: June 2017
 
 

Example: How to Enable the MySQL Software to Run in the Cluster

  1. Start the MySQL database manually on both nodes.
    phys-schost-1# cd /usr/local/mysql
    phys-schost-1# ./bin/mysqld --defaults-file=/local/mysql-data/my.cnf \
    --basedir=/usr/local/mysql --datadir=/local/mysql-data \
    --pid-file=/local/mysql-data/mysqld.pid \
    --user=mysql >> /local/mysql-data/logs/phys-schost-1.log 2>&1

    Note -  Make sure to change phys-schost-1 to phys-schost-2 on the second node.
  2. Set the password for localhost in MySQL to root on both nodes.
    phys-schost-1# /usr/local/mysql/bin/mysqladmin -S /tmp/phys-schost-1.sock -uroot \ password 'root'

    Note -  Make sure to change phys-schost-1 to phys-schost-2 on the second node.
  3. Add an administrative user in the MySQL database for the physical host on both nodes.
    phys-schost-1# /usr/local/mysql/bin/mysql -S /tmp/phys-schost-1.sock -uroot -proot
    mysql> use mysql;
    mysql> GRANT ALL ON *.* TO 'root'@'phys-schost-1' IDENTIFIED BY 'root';
    mysql> UPDATE user SET Grant_priv='Y' WHERE User='root' AND Host='phys-schost-1';
    mysql> exit

    Note -  Make sure to change phys-schost-1 to phys-schost-2 on the second node.
  4. Prepare the Oracle Solaris Cluster specific test database on both nodes.
    phys-schost-1# ksh /opt/SUNWscmys/util/mysql_register -f /local/mysql_config
  5. Stop the MySQL database.
    phys-schost-1# kill -TERM 'cat /local/mysql-data/mysqld.pid'
  6. Make the /global/mnt3/ha_mysql_config file available on all nodes to run the MySQL database.
  7. Encrypt the fault monitor user password on one node to run the MySQL database.
    phys-schost-1# 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.

  8. Run the ha_mysql_register script to register the resource on one node.
    phys-schost-1# ksh /opt/SUNWscmys/util/ha_mysql_register \
    -f /local/ha_mysql_config
  9. Enable the resource.
    phys-schost-1# clresource enable RS-MYSQL