JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Cluster Data Service for MySQL Cluster Guide     Oracle Solaris Cluster 4.1
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

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 the 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

Create the directory structure and configuration by performing the following steps on both nodes

  1. Create the directory structure.
    phys-schost-1:/ # mkdir -p /mysql-data/logs /mysql-data/innodb
    phys-schost-2:/ # mkdir -p /mysql-data/logs /mysql-data/innodb
  2. Initialize the MySQL database
    phys-schost-1: # cd /usr/local/mysql 
    phys-schost-1:/usr/local/mysql # ./scripts/* --datadir=/mysql-data
    
    phys-schost-2: # cd /usr/local/mysql 
    phys-schost-2:/usr/local/mysql # ./scripts/* --datadir=/mysql-data
  3. Prepare the my.cnf-serv file in /temp/cluconfig.

    Use the example values in the my.cnf File for the First SQL Node phys-schost-1 to Store in /mysql-data for phys-schost-1, and my.cnf File for the Second SQL Node phys-schost-2 to Store in /mysql-data for phys-schost-2.

    phys-schost-1:/ # cp /temp/cluconfig/my.cnf-serv /mysql-data/my.cnf
    phys-schost-1:/ # chmod 644 /mysql-data/my.cnf
    
    phys-schost-2:/ # cp /temp/cluconfig/my.cnf-serv /mysql-data/my.cnf
    phys-schost-2:/ # chmod 644 /mysql-data/my.cnf
  4. Copy my.cnf file from /temp/cluconfig/my.cnf-serv, adjust the parameters as appropriate, and change the permissions.
  5. Change the ownership of the data directory.
    phys-schost-1:/ # chown -R mysql:dba /mysql-data
    phys-schost-2:/ # chown -R mysql:dba /mysql-data
  6. Start the MySQL server for the first time and specify the grants.
    1. Create a start script on both nodes with the appropriate values.
      phys-schost-1:/ # 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/phys-schost-1.log 2>&1 &
      EOF
      phys-schost-2:/ # 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/phys-schost-2.log 2>&1 &EOF
    2. Execute the start script /temp/cluconfig/first on both nodes.
      phys-schost-1:/ # . /temp/cluconfig/first
      phys-schost-2:/ # . /temp/cluconfig/first
  7. Wait 60 seconds and verify that the MySQL servers connect to the ndb data nodes.
    1. On one node, issue the following command.
      phys-schost-2:/ # /usr/local/mysql/bin/ndb_mgm \
      > --ndb-connectstring=phys-schost-1,phys-schost-2 -e show
    2. Set the administrative password on both nodes.
      phys-schost-1:/ # /usr/local/mysql/bin/mysqladmin -S /tmp/phys-schost-1.sock \
      > -uroot password 'root'
      phys-schost-2:/ # /usr/local/mysql/bin/mysqladmin -S /tmp/phys-schost-2.sock \
      > -uroot password 'root'
    3. Define the administrative user.
      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
      
      phys-schost-2:/ # /usr/local/mysql/bin/mysql -S /tmp/phys-schost-2.sock \
      > -uroot -proot
      mysql> use mysql;
      mysql> grant all on *.* to 'root'@'phys-schost-2' identified by 'root';
      mysql> UPDATE user SET Grant_priv='Y' WHERE User='root' AND Host='phys-schost-2';
      mysql> exit
  8. Prepare the MySQL server for Oracle Solaris Cluster usage.
    1. Prepare a mysql_config file under /temp/cluconfig.

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

    2. Set the MYSQL_NIC_HOSTNAME values.

      On phys-schost-1

      MYSQL_NIC_HOSTNAME=" phys-schost-1 "

      On phys-schost-2

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