Skip Navigation Links
Exit Print View
| Oracle Solaris Cluster Data Service for MySQL Cluster Guide Oracle Solaris Cluster 4.1

Search Scope:

- This Document
- Entire Library

## Registering and Configuring HA for MySQL Cluster

Before you perform the procedures in this section, ensure that the HA for MySQL Cluster data service packages are installed.

Use the configuration and registration files in the `/opt/SUNWscmys/*/util` directories to register the HA for MySQL Cluster resources. The configuration files define the dependencies that are required between the HA for MySQL Cluster component and other resources. For information about these dependencies, see Dependencies Between HA for MySQL Cluster Components.

This section covers the following main topics:

- Specifying Configuration Parameters for the MySQL Cluster Management Server Resource

- How to Create and Enable Resources for MySQL Cluster Management Server

- Specifying Configuration Parameters for the MySQL Cluster `ndb` Daemon Resource

- How to Create and Enable Resources for the MySQL Cluster `ndb` Daemon

- Specifying Configuration Parameters for the MySQL Cluster `ndb` Shutdown Controller Resource

- How to Create and Enable Resources for MySQL Cluster `ndb` Shutdown Controller

- How to Suspend the `ndb` Shutdown Controller's Stop Action

- How to Create and Enable Resources for the MySQL Server

### Specifying Configuration Parameters for the MySQL Cluster Management Server Resource

HA for MySQL Cluster provides a script that automates the process of configuring the MySQL Cluster management server resource. This script obtains configuration parameters from the `mysql_ndb_mgmd_config` file. A template for this file is in the `/opt/SUNWscmys/ndb_mgmd/util` directory. To specify configuration parameters for the MySQL Cluster management server resource, copy the `mysql_ndb_mgmd_config` file to another directory and edit this `mysql_ndb_mgmd_config` file.

Note - This configuration file needs to be accessible from the global or local zone on each node where the MySQL Cluster is installed.

Each configuration parameter in the `mysql_ndb_mgmd_config` file is defined as a keyword-value pair. The `mysql_ndb_mgmd_config` file already contains the required keywords and equals signs. For more information, see `mysql_ndb_mgmd_config` File. When you edit the `/myplace/mysql_ndb_mgmd_config` file, add the required value to each keyword listed in the following table.

Table 1-4 Keyword-Value Pairs in the `mysql_ndb_mgmd_config` File

Parameter | Description | Example
`RS=mgmd-resource` | Specifies the name that you are assigning to the MySQL Cluster management server resource. You must specify a value for this keyword. | The name of the MySQL Cluster management server resource is `mgm-rs`
`RG=mgmd-resource-group` | Specifies the name of the resource group where the MySQL Cluster management server resource will reside. You must specify a value for this keyword. | The name of the MySQL Cluster management server resource group is `mgm-rg`.
`PORT=1186 LH=shared-address-resource` | Specifies the value of a dummy port. This variable is used only at registration time. If you will not specify a `LH` variable, omit this value. | The value of the port for the MySQL Cluster management server resource is `1186`.
`LH=shared-address-resource` | Specifies the name of the `SUNW.SharedAddress` resource for the MySQL Cluster management server resource. This name must be the `SUNW.SharedAddress` resource name you assigned when you created the resource in How to Enable a MySQL Cluster Database to Run in a Global Zone Configuration. If you did not register a `SUNW.SharedAddress` resource, omit this value. | The name of the `SUNW.SharedAddress` resource for the MySQL Cluster management server resource`mysqlclu-sa`.
`SCALABLE=scalable-trigger` | Specifies a scalable registration for the MySQL Cluster management server resource. Any value here will trigger a scalable registration. If you did not register a `SUNW.SharedAddress` resource, omit this value. | It is a scalable resource, so the value for the scalable trigger `SCALABLE` is `y`.
`LB_POLICY=loadbalancing-policy` | Specifies the load-balancing policy for a scalable resource. Leaving this parameter empty for a scalable resource results in the default load-balancing policy. If you did not register a `SUNW.SharedAddress` resource, or if you want to use the default load-balancing configuration, omit this value. | The default load-balancing policy is used, so the `LB_POLICY` variable is `empty`.
`HAS_RS=dependency-list` | Specifies a comma-separated list of resources that the MySQL Cluster management server depends on. | The MySQL Cluster management server resource does not depend on any other resource. So the `HAS_RS` variable is `empty`.
`RS_PROP=resource-property-string` | Specifies a string that is formatted as: `-p property-value=value`. | Additional standard and extension properties.
`PARFILE=parameter-file` | Specifies the name of the parameter file where the MySQL Cluster management server specific parameters of the MySQL Cluster management server resource are stored. This file will be created during the registration process. You must specify a value for this keyword. | The parameter file is `/pfile/mgmd-pfile`, so the `PARFILE` variable is set to `/pfile/mgmd-pfile`.
`BASEDIR=MySQL-base-directory` | Specifies the directory where MySQL is installed. A valid `BASEDIR` variable specifies a directory which contains `ndb_mgmd` under `bin` or `libexec`. | MySQL is installed in `/usr/local/mysql`, so the value of `BASEDIR` is `/usr/local/mysql`.
`USER=mgmd-user` | Specifies the user under which the MySQL Cluster management server is started. If you do not specify any value, the MySQL Cluster management server is started as root. | The MySQL Cluster management server should be started under the `root` user, so the `USER` variable is `mgmd-user`.
`TRY_RECONNECT=1` | Specifies how often a connection to the MySQL Cluster management server should be retried before the attempt is abandoned. You must specify a value for this parameter. | If the first connection failure to a MySQL Cluster management server should lead to an abort, so the value of `TRY_RECONNECT` is `1`.
`CONNECT_STRING=mgm-connect- string` | Specifies a valid connect string for the management servers in the format `nodename_1[:port]`, `nodename_2[:port]`. The local management server must be the first `nodename` in the list. | The MySQL Cluster management servers are running on `priv_node1` and `priv_node2`, so `CONNECT STRING` is set to `priv_node1`, `priv_node2`.
`CONFIG_DIR=directory-for- config.ini` | Specifies the directory where the MySQL Cluster configuration file `config.ini` and the management server's cache file are stored. You must specify a value for this parameter. | The `config.ini` file is placed under `/mgmd-data`, so the `CONFIG_DIR` variable is set to `/mgmd-data`.
`ID=mgmd-server-id` | Specifies the unique server ID for this management server. The value must match the entry in the `config.ini` file. You must specify a value for this parameter. | The unique ID on `priv_node1` is 1 and the unique ID on `priv_node2` is 2, so ID is set to `1`. The unique ID on `priv_node1` is 1 and the unique ID on `priv_node2` is 2, so ID is set to `2`.

## How to Create and Enable Resources for MySQL Cluster Management Server

Before You Begin

Ensure that you have edited the `mysql_ndb_mgmd_config` file to specify configuration parameters for the Oracle Solaris Cluster HA for Management Server data service. For more information, see Specifying Configuration Parameters for the MySQL Cluster Management Server Resource.

1. Create the parameter file directory on all nodes and zones to run the MySQL Cluster management server.

       # mkdir /pfile

2. Create the parameter file on all nodes and zones to run the MySQL Cluster management server.

       # ksh /opt/SUNWscmys/ndb_mgmd/util/mysql_ndb_mgmd_register \
       > -f /myplace/mysql_ndb_mgmd_config -p

3. Register the resource for the MySQL Cluster management server on one node.

       # ksh /opt/SUNWscmys/ndb_mgmd/util/mysql_ndb_mgmd_register \
       > -f /myplace/mysql_ndb_mgmd_config

4. Enable the MySQL Cluster management server resource group

       # clresourcegroup online -eM mgm-rg

### Specifying Configuration Parameters for the MySQL Cluster `ndb` Daemon Resource

Oracle Solaris Cluster HA for MySQL Cluster provides a script that automates the process of configuring the MySQL Cluster `ndb` daemon resource. This script obtains configuration parameters from the `mysql_ndbd_config` file. A template for this file is in the `/opt/SUNWscmys/ndbd/util` directory. To specify configuration parameters for the MySQL Cluster `ndb` daemon resource, copy the`mysql_ndbd_config` file to another directory and edit this `mysql_ndbd_config` file.

Note - This configuration file needs to be accessible from the global or local zone on each node where the MySQL Cluster is installed.

Each configuration parameter in the `mysql_ndbd_config` file is defined as a keyword-value pair. The `mysql_ndbd_config` file already contains the required keywords and equals signs. For more information, see `mysql_ndbd_config` File. When you edit the `/myplace/mysql_ndbd_config` file, add the required value to each keyword.

The keyword-value pairs in the `mysql_ndbd_config` file are listed in the following table.

Table 1-5 Keyword-Value Pairs in the `mysql_ndbd_config` File

Parameter | Description | Example
`RS=ndb-daemon-resource` | Specifies the name that you are assigning to the MySQL Cluster `ndb` daemon resource. You must specify a value for this keyword. | The name of the MySQL Cluster `ndb` daemon resource is `ndb-rs`.
`RG=ndb-daemon-resource-group` | Specifies the name of the resource group where the MySQL Cluster `ndb` daemon resource will reside. You must specify a value for this keyword. | The name of the MySQL Cluster `ndb` daemon resource group is `ndb-rg`.
`HAS_RS=mgmd-resource,dependency-list` | Specifies a comma-separated list of resources that the MySQL Cluster `ndb` daemon depends on. You must include the resource name of the MySQL Cluster management server resource here. | The MySQL Cluster `ndb` daemon resource depends on the management server resource `mgm-rs`. So the `HAS_RS` variable is set to `mgm-rs`.
`RS_PROP=resource-property-string` | Specifies a string that is formatted as `-p property-value=value`. | Additional standard and extension properties.
`PARFILE=parameter-file` | Specifies the name of the parameter file where the MySQL Cluster `ndb` daemon specific parameters of the MySQL Cluster `ndb` daemon resource are stored. This file is automatically created at registration time. You must specify a value for this keyword. | The parameter file is `/pfile/ndbd-pfile`, so the `PARFILE` variable is set to `/pfile/ndbd-pfile`.
`BASEDIR=mysql-base-directory` | Specifies the directory where MySQL is installed. A valid `BASEDIR` value specifies a directory which contains `ndbd` under `bin` or `libexec`. | MySQL is installed in `/usr/local/mysql`, so the value of `BASEDIR` is `/usr/local/mysql`.
`USER=mgmd-user` | Specifies the user under which the MySQL Cluster `ndb` daemon is started. If you do not specify any value, the MySQL Cluster management server is started as root. | The MySQL Cluster `ndb` daemon should be started under the root user, so the `USER` variable is `empty`.
`TRY_RECONNECT=1` | Specifies how often a connection to the MySQL Cluster management server should be retried before the attempt is abandoned. You must specify a value for this parameter. | If the first connection failure to a MySQL Cluster management server should lead to an abort, so the value of `TRY_RECONNECT` is `1`.
`CONNECT_STRING=mgm-connect-string` | Specifies a valid connect string for the management servers in the format `priv_nodename_1[:port]`, `priv_nodename_2[:port]`. | The MySQL Cluster management servers are running on `priv_node1` and `priv_node2`, so `CONNECT STRING` is set to `priv_node1,priv_node2`.
`ID=ndb-server-id` | Specifies the unique server ID for this `ndb` daemon. The value must match the entry in the management servers `config.ini` file. You must specify a value for this parameter. | The unique id on `priv_node1` is 3 and the unique id on `priv_node2` is 4. The `clprivnet` address on node 1 translates to `priv_node1`, so ID is set to `3`. The unique id on `priv_node1` is 3 and the unique id on `priv_node2` is 4. The `clprivnet` address on node 2 translates to `priv_node2`, so `ID` is set to `4`.
`MULTI_THREAD=multithreading-trigger` | Any entry here triggers the start of the multithreaded version of the `ndb` daemon. Leaving this value undefined results in the start of the single-threaded `ndb` daemon. | The Multithreading trigger `MULTI_THREAD` is set to `y`.
`DATA_DIR=ndb data directory` | Specifies the directory where the `my.cnf` file and the data for the `ndb` daemon is stored. You must specify a value for this parameter. | The data directory for the `ndb` daemon is `/ndbd-data`, so `DATA_DIR` is set to`/ndbd-data`.
`ERROR_ON_SHOW=error-code-for-failed-mgm- connections` | Specifies the return code value for failed connections of the probe command to the management servers. The value should be less than or equal to 100 and follows the semantics for a `SUNW.gds probe` command. You must specify a value for this parameter. | The error code for failed management server connections is 25, so `ERROR_ON_SHOW` is set to 25.

## How to Create and Enable Resources for the MySQL Cluster `ndb` Daemon

Before You Begin

Ensure that you have edited the `mysql_ndbd_config` file to specify configuration parameters for the Oracle Solaris Cluster HA for `ndb` Daemon data service. For more information, see Specifying Configuration Parameters for the MySQL Cluster `ndb` Daemon Resource.

1. Create the parameter file directory on all nodes and zones to run the MySQL Cluster `ndb` daemon, if you have not done so already.

       # mkdir /pfile

2. Create the parameter file on all nodes and zones to run the MySQL Cluster `ndb` daemon.

       # ksh /opt/SUNWscmys/ndbd/util/mysql_ndbd_register \
       > -f /myplace/mysql_ndbd_config -p

3. Register the resource for the MySQL Cluster `ndb` daemon on one node.

       # ksh /opt/SUNWscmys/ndbd/util/mysql_ndbd_register \
       > -f /myplace/mysql_ndbd_config

4. Enable the MySQL Cluster management server resource group

       # clresourcegroup online -eM ndb-rg

### Specifying Configuration Parameters for the MySQL Cluster `ndb` Shutdown Controller Resource

Oracle Solaris Cluster HA for MySQL Cluster provides a script that automates the process of configuring the MySQL Cluster `ndb` shutdown controller resource. This script obtains configuration parameters from the `ndbd_shutdown_config` file. A template for this file is in the `/opt/SUNWscmys/ndbd_shutdown/util` directory. To specify configuration parameters for the MySQL Cluster `ndb` shutdown controller resource, copy the `ndbd_shutdown_config` file to another directory and edit this `ndbd_shutdown_config` file.

Each configuration parameter in the `ndbd_shutdown_config` file is defined as a keyword-value pair. The `ndbd_shutdown_config` file already contains the required keywords and equals signs. For more information, see `ndb_shutdown_config` File. When you edit the `/myplace/ndbd_shutdown_config` file, add the required value to each keyword.

The keyword-value pairs in the `ndbd_shutdown_config` file are as follows.

Table 1-6 Keyword-Value Pairs in the `ndbd_shutdown_config` File

Parameter | Description | Example
`RS=ndb-shutdown-controller-resource` | Specifies the name that you are assigning to the MySQL Cluster `ndb` shutdown controller resource. You must specify a value for this keyword. | The name of the MySQL Cluster `ndb` daemon resource is `ndb-shut-rs`.
`RG=ndb-shutdown-controller-resource-group` | Specifies the name of the resource group where the MySQL Cluster `ndb` shutdown controller resource will reside. You must specify a value for this keyword. | The name of the MySQL Cluster `ndb` daemon resource group is `ndb-rg`.
`HAS_RS=ndbd-daemon-resource, dependency-list` | Specifies a comma-separated list of resources such that the MySQL Cluster `ndb` shutdown controller depends on. You must include the resource name of all such resources. | The MySQL Cluster `ndb` shutdown controller resource does depend on the `ndb` daemon resource `ndb_rs`. So the `HAS_RS` variable is set to `ndb-rs`.
`RS_PROP=resource- property-string` | Specifies a string that is formatted as `-p property-value=value`. | Additional standard and extension properties.
`PARFILE=ndbd-daemon-resource- parameter-file` | Specifies the name of the parameter file of one MySQL Cluster `ndb` daemon resource. You must specify a value for this keyword. | The parameter file is `/pfile/ndbd-pfile`, so the `PARFILE` variable is set to `/pfile/ndbd-pfile`.

## How to Create and Enable Resources for MySQL Cluster `ndb` Shutdown Controller

Before You Begin

Ensure that you have edited the `ndbd_shutdown_config` file to specify configuration parameters for the Oracle Solaris Cluster HA for `ndb` Shutdown Controller data service. For more information, see Specifying Configuration Parameters for the MySQL Cluster `ndb` Shutdown Controller Resource.

1. Register the resource for the MySQL Cluster `ndb` daemon on one node.

       # ksh /opt/SUNWscmys/ndbd_shutdown/util/ndb_shutdown_register \
       > -f /myplace/ndbd_shutdown_config

2. Enable the MySQL Cluster management server resource group

       # clresourcegroup online -eM ndb-rg

## How to Suspend the `ndb` Shutdown Controller's Stop Action

If you want to take the `ndbd` daemon offline on one node only, you must suspend the stop action of the `ndb` shutdown controller. Otherwise, it restarts all `ndbd` daemons without loading data.

Perform the following task before you disable the shutdown controller resource on one node, or before you take offline the resource group that contains the `ndb` daemon resource and the `ndb` shutdown controller resource.

- On one node, suspend the stop action of the `ndb` shutdown controller.

      # touch /tmp/shutdown-controller-resourcename_noop

  Note - During the stop, the `noop` file is removed.

## How to Create and Enable Resources for the MySQL Server

Before You Begin

Before you begin make sure you already bootstrapped the MySQL Server on all nodes and zones to host the MySQL server.

This procedure provides the general steps to register a MySQL server. For complete instructions, see Registering and Configuring HA for MySQL Cluster. However, the deployment example in Appendix B, Deployment Example: Installing MySQL Cluster in the Global Zone shows all the steps to their full extent.

If you want monitoring of an `ndb` table by each SQL server you are about to configure, set `NDB_CHECK=yes` in the configuration files `mysql_config` and `ha_mysql_config`. This setting creates a functional dependency between the MySQL servers and the MySQL Cluster data node processes. Consider deploying the MySQL server in a scalable or multiple-masters topology.

1. Prepare the MySQL server on each node and zone to run the MySQL server.
   1. Execute the `mysqladmin` command.
   2. Include the GRANT and UPDATE statements on each MySQL server you configured.

      For more details about the GRANT and UPDATE statements for each of the MySQL server you have configured, see Oracle Solaris Cluster Data Service for MySQL Guide.

2. Issue the `/opt/SUNWscmys/util/mysql_register` command on each MySQL server you configured.
3. (Optional) Make the `ha_mysql_config` file available on all nodes where the MySQL server is to run and execute.

       # /opt/SUNWscmys/util/ha_mysql_register -f config-file -e

   `-e`

     (Optional) Specifies that you want password encryption.

4. On one node, run the resource registration script.

       # /opt/SUNWscmys/util/ha_mysql_register -f config-file

Copyright © 2000, 2012, Oracle and/or its affiliates. All rights reserved. Legal Notices |