JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Cluster Data Service for MySQL Cluster Guide
search filter icon
search icon

Document Information

Preface

1.  Installing and Configuring HA for MySQL Cluster

A.  Files for Configuring HA for MySQL Cluster

B.  Deployment Example: Installing MySQL Cluster in the Global Zone

C.  Deployment Example: Installing MySQL Cluster in a Non-Global Zone

Target Cluster Configuration

Software Configuration

How to Install MySQL Cluster Software

Setting Up the MySQL Cluster Control

How to Configure the Management Server on Both Nodes

How to Configure the Data Nodes on Both Nodes

How to Initialize the MySQL Server

How to Create the HA for MySQL Cluster Configuration With Scalable Services

Example Configuration Files for Installation in a Non-Global Zone

config.ini File for Both Nodes to Store in /mgm-data

my.cnf File for the Data Nodes to Store in /ndbd-data

my.cnf File for the First SQL Node phys-schost-1 to Store in /mysql-data

my.cnf File for the Second SQL Node phys-schost-2 to Store in /mysql-data

mysql_config File for the First SQL Node phys-schost-1 to Store in /temp/cluconfig

mysql_config File for the Second SQL Node phys-schost-2 to Store in /temp/cluconfig

mysql_ndb_mgmd_config File for the First Node phys-schost-1

mysql_ndb_mgmd_config File for the Second Node phys-schost-2

mysql_ndbd_config File for the First Node phys-schost-2

mysql_ndbd_config File for the Second Node phys-schost-2

ndbd_shutdown_config File for One Node

ha_mysql_config File for One Node

Index

How to Initialize the MySQL Server

  1. Create the directory structure and configuration on both nodes.
    1. Create the directory structure in the non-global zones.
      zone1:/ # mkdir -p /mysql-data/logs /mysql-data/innodb
      zone2:/ # mkdir -p /mysql-data/logs /mysql-data/innodb
    2. On the non-global zones, initialize the MySQL database.
      zone1: # cd /usr/local/mysql 
      zone1:/usr/local/mysql # ./scripts/* --datadir=/mysql-data
      zone2: # cd /usr/local/mysql 
      zone2:/usr/local/mysql # ./scripts/* --datadir=/mysql-data
    3. On the non-global zones, create the my.cnf file.

      Create the corresponding my.cnf file in /temp/cluconfig/my.cnf-serv, adjust the parameters as appropriate, and change the permissions.

      Prepare the my.cnf-serv file in /temp/cluconfig with the example values in the my.cnf File for the First SQL Node phys-schost-1 to Store in /mysql-data for zone1 and my.cnf File for the Second SQL Node phys-schost-2 to Store in /mysql-data for zone2.

      zone1:/ # cp /temp/cluconfig/my.cnf-serv /mysql-data/my.cnf
      zone1:/ # chmod 644 /mysql-data/my.cnf
      zone2:/ # cp /temp/cluconfig/my.cnf-serv /mysql-data/my.cnf
      zone2:/ # chmod 644 /mysql-data/my.cnf
    4. Change the ownership of the data directory.
      zone1:/ # chown -R mysql:dba /mysql-data
      zone2:/ # chown -R mysql:dba /mysql-data
  2. Start the MySQL server for the first time and specify the grants.
    1. Create a start script on the non-global zones on both nodes with the appropriate values.

      Adapt the values for your configuration.

      zone1:/ # cat >/temp/cluconfig/first <<EOF
      /usr/local/mysql/bin/mysqld --defaults-file=/mysql-data/my.cnf \ --basedir=/usr/local/mysql --datadir=/mysql-data \ --pid-file=/mysql-data/mysqld.pid \ --user=mysql >> /mysql-data/logs/zone1.log 2>&1 &
      EOF
      zone2:/ # cat >/temp/cluconfig/first <<EOF
      /usr/local/mysql/bin/mysqld --defaults-file=/mysql-data/my.cnf \ --basedir=/usr/local/mysql --datadir=/mysql-data \ --pid-file=/mysql-data/mysqld.pid \ --user=mysql >> /mysql-data/logs/zone2.log 2>&1 &
      EOF
    2. Execute the start script /temp/cluconfig/first in the non-global zones on both nodes.
      zone1:/ # . /temp/cluconfig/first
      zone2:/ # . /temp/cluconfig/first
  3. Wait 60 seconds and verify that the MySQL servers connect to the ndb data nodes.
    1. On one zone, issue the following command.
      zone1:/ # /usr/local/mysql/bin/ndb_mgm \
      > --ndb-connectstring=zone1,zone2 -e show
    2. Set the administrative password in the non-global zones on both nodes.
      zone1:/ # /usr/local/mysql/bin/mysqladmin -S /tmp/zone1.sock \
      > -uroot password 'root'
      zone2:/ # /usr/local/mysql/bin/mysqladmin -S /tmp/zone2.sock \
      > -uroot password 'root'
    3. Define the administrative user.
      zone1:/ # /usr/local/mysql/bin/mysql -S /tmp/zone1.sock \
      > -uroot -proot
      mysql> use mysql;
      mysql> grant all on *.* to 'root'@'zone1' identified by 'root';
      mysql> UPDATE user SET Grant_priv='Y' WHERE User='root' AND Host='zone1';
      mysql> exit
      zone2:/ # /usr/local/mysql/bin/mysql -S /tmp/zone2.sock \
      > -uroot -proot
      mysql> use mysql;
      mysql> grant all on *.* to 'root'@'zone2' identified by 'root';
      mysql> UPDATE user SET Grant_priv='Y' WHERE User='root' AND Host='zone2';
      mysql> exit
  4. Prepare the MySQL server for Oracle Solaris Cluster usage.
    1. Prepare a mysql_config file under the /temp/cluconfig directory.

      Use the content from mysql_config File for the First SQL Node phys-schost-1 to Store in /temp/cluconfig on zone1 and the content from mysql_config File for the Second SQL Node phys-schost-2 to Store in /temp/cluconfig on zone2.

    2. Set the MYSQL_NIC_HOSTNAMEvalues.
      • On zone1, set the following value:

        MYSQL_NIC_HOSTNAME=" zone1 "
      • On zone2, set the following value:

        MYSQL_NIC_HOSTNAME=" zone2 "
    3. In the non-global zones on both nodes, execute the following commands.
      zone1:/ # ksh /opt/SUNWscmys/util/mysql_register \
      > -f /temp/cluconfig/mysql_config 
      zone2:/ # ksh /opt/SUNWscmys/util/mysql_register \
      > -f /temp/cluconfig/mysql_config 
    4. Shut down the MySQL server in the non-global zones on both nodes.
      zone1:/ # pkill -f mysqld
      zone2:/ # pkill -f mysqld
    5. On one node, shut down the MySQL Cluster components in the non-global zone.
      zone1:/ # /usr/local/mysql/bin/ndb_mgm \
      > --ndb-connectstring=phys-schost-1-p,phys-schost-2-p -e shutdown
    6. Verify the shutdown.
      zone1:/ # /usr/local/mysql/bin/ndb_mgm \
      > --ndb-connectstring=zone_1_p,zone_2_p -e show
    7. Shut down potentially running daemons.
      zone1:/ # /usr/local/mysql/bin/ndb_mgm \
      > --ndb-connectstring=zone_1_p,zone_2_p -e "id stop"

      Leave the non-global zone on both nodes.