MySQL Cluster Manager 9.1 User Manual  /  MySQL Cluster Manager Client Commands  /  MySQL Cluster Manager Configuration Commands

5.5 MySQL Cluster Manager Configuration Commands

This section covers the commands used in the MySQL Cluster Manager for getting and setting values of various types used in MySQL NDB Cluster configuration. We begin with a discussion of what we mean by the term configuration attribute, and how this relates to the manual configuration of a MySQL NDB Cluster using MySQL NDB Cluster configuration parameters and MySQL Server options and variables that you may already be familiar with.

Configuration attributes.  Traditionally, when administering MySQL NDB Cluster, it has been necessary to distinguish between 3 types of configuration data:

  • Configuration parameters set in the MySQL NDB Cluster global configuration file read by the management server (or servers), by convention named config.ini

  • Configuration variables set in a running MySQL server (SQL node) by using the SQL SET statement in the mysql command-line client (or in another MySQL client application)

  • Configuration options passed to MySQL NDB Cluster executable programs when invoking them

    Note

    Configuration options passed to mysqld often have the effect of setting values for configuration variables, many—but not all—of which can be overridden in a running MySQL server using a MySQL client application such as mysql.

MySQL Cluster Manager simplifies this configuration scheme by treating all 3 types of configuration data as attributes, where the term attribute refers to a MySQL NDB Cluster configuration parameter, a MySQL Server variable, or a command-line option used with one or more MySQL NDB Cluster binary programs. It does this transparently, handling all necessary changes in a unified interface.

Suppose that you wish to know how much data memory is allocated to the data nodes in a given MySQL NDB Cluster. Rather than having to determine that this is controlled using the DataMemory configuration parameter that is written in the config.ini file and then reading that file to find the value, you merely invoke the MySQL Cluster Manager get command, and MySQL Cluster Manager handles reading from the file for you, and displays the value without the necessity of opening the file in a separate application such as more or less. If you wish to change the amount of data memory allocated to the data nodes, you can issue a MySQL Cluster Manager set (or reset) command; MySQL Cluster Manager then writes the desired value to config.ini. If—as is the case with DataMemory—updating a configuration value in a running MySQL NDB Cluster requires a rolling restart to be performed, MySQL Cluster Manager can perform this operation automatically so that the configuration change takes effect without further intervention required on the part of the operator.

Configuration attribute levels.  A configuration attribute value applies at one of the three levels, described here:

  • Default: This value is always used by any MySQL NDB Cluster process of the type or types (such as ndbd or mysqld) to which the attribute applies, unless this value is overridden by the user.

  • Process: This value is used for all instances of a given type of MySQL NDB Cluster process.

  • Instance: This value is used for a specific instance of a MySQL NDB Cluster process, the instance being identified by its MySQL NDB Cluster node ID.

Default values are hard-coded into MySQL NDB Cluster; you can override a default value for a given configuration attribute (using the set command) or reset a given attribute value to its default (using the reset command), but you cannot change a default value itself. You can set or reset an configuration attribute's value on either the process level or the instance level using a single set or reset command. Once you have set or reset the value of a configuration attribute, this value persists until it is changed by executing another set or reset command.

Note

When setting or resetting a configuration attribute value, you must specify the level at which the setting applies.

MySQL Cluster Manager determines what value to use for a configuration attribute relating to a given process by following these steps for each MySQL NDB Cluster process:

(For each configuration attribute:)

  1. Is an attribute value defined for the node ID of this process?

    Yes: Use the value that was defined for this node ID, and exit.

    No: Proceed to the next step.

  2. Is an attribute value specified on the process level, that is, for all processes of this type?

    Yes: Use the value that was specified for all processes of this type, and exit.

    No: Use the default value that applies to processes of this type, and exit.

(In the steps just shown, exit can be taken to mean If there are more configuration attributes applicable to this process that have not yet been set, proceed to the next attribute until there are no more attributes to be set for this process.)

Note

The most recently specified value takes precedence. This means that if you set a configuration attribute for a specific process, then later specify a process-level value for this attribute, the process-level value is used for all processes of that type, including the instance for which you earlier set an instance-specific value.

Mandatory attributes.  Some attributes must be defined in the MySQL Cluster Manager at the process type or instance level for all processes of the applicable type or types for the cluster configuration to be valid. Such mandatory attributes may be changed, but not reset; in other words, the definition can be changed, but the definition itself cannot be removed entirely. Another way of stating this is that a mandatory attribute has no default value.

An example of a mandatory attribute is NodeId. If you try to reset a mandatory attribute, the attempt fails with an error, as shown here:

mcm> reset NodeId:ndb_mgmd:1 mycluster;
ERROR 6007 (00MGR): Config attribute NodeId is mandatory and cannot be reset
mcm> reset NodeId:ndbd:2 mycluster;
ERROR 6007 (00MGR): Config attribute NodeId is mandatory and cannot be reset
mcm> reset NodeId:mysqld:4 mycluster;
ERROR 6007 (00MGR): Config attribute NodeId is mandatory and cannot be reset

Read-only attributes.  A read-only attribute is an attribute that must be defined by the MySQL Cluster Manager when a cluster is created. A read-only attribute can be neither changed nor reset by the user. This means that a read-only attribute is always a mandatory attribute.

One such attribute is HostName, which is read only for any type of MySQL NDB Cluster process. Any attempt to change or reset a read-only attribute fails, as shown here:

mcm> reset HostName:ndb_mgmd mycluster;
ERROR 6008 (00MGR): Config attribute HostName is readonly and cannot be changed
mcm> reset HostName:ndbd mycluster;
ERROR 6008 (00MGR): Config attribute HostName is readonly and cannot be changed
mcm> reset HostName:mysqld mycluster;
ERROR 6008 (00MGR): Config attribute HostName is readonly and cannot be changed

mcm> set HostName:ndb_mgmd mycluster;
ERROR 6008 (00MGR): Config attribute HostName is readonly and cannot be changed
mcm> set HostName:ndbd mycluster;
ERROR 6008 (00MGR): Config attribute HostName is readonly and cannot be changed
mcm> set HostName:mysqld mycluster;
ERROR 6008 (00MGR): Config attribute HostName is readonly and cannot be changed

An attribute that is mandatory or read only is set when a cluster is created. Neither a mandatory attribute nor a read-only attribute can be reset. (Neither type of attribute has a default value other than what is set for it when the cluster is created.) A mandatory attribute can be changed at any time by the user; a read-only attribute cannot be changed once the cluster has been created. You can obtain a listing of mandatory and read-only attributes using the get command.

A listing of attribute properties also can be found in the output of ndb_config --configinfo --xml (see ndb_config — Extract NDB Cluster Configuration Information); for more complete information, see Configuration of NDB Cluster.

MySQL Cluster Manager determines internally which attributes are considered read-only for reasons of cluster stability and performance. You can use the get command to see which attributes are read only.

Command-line-only attributes.  Command-line-only attributes are attributes that, when outside of MySQL Cluster Manager, must be specified as command-line options instead of parameters in a configuration file (for example, config.ini or my.cnf). These include all the command-line options of the ndb_mgmd, ndbd, and ndbmtd nodes, as well as mysqld options listed in Server Option, System Variable, and Status Variable Reference as not valid in option files. A small number of these command-line-only attributes can, however, be configured with MySQL Cluster Manager using the set and reset commands, and their values can be checked with the get command; they include:

These command-line-only attributes supported by the get, set, and reset commands are marked with Command Line in the Comment column of the get command's output:

mcm> set log-name:ndb_mgmd=Mgm145  mycluster;
+-----------------------------------+
| Command result                    |
+-----------------------------------+
| Cluster reconfigured successfully |
+-----------------------------------+
1 row in set (27.37 sec)

mcm> get -d log-name:ndb_mgmd mycluster;
+----------+--------+----------+---------+----------+---------+---------+--------------+
| Name     | Value  | Process1 | NodeId1 | Process2 | NodeId2 | Level   | Comment      |
+----------+--------+----------+---------+----------+---------+---------+--------------+
| log-name | Mgm145 | ndb_mgmd | 145     |          |         | Process | Command Line |
+----------+--------+----------+---------+----------+---------+---------+--------------+
1 row in set (0.10 sec)

mcm> reset log-name:ndb_mgmd mycluster;
+-----------------------------------+
| Command result                    |
+-----------------------------------+
| Cluster reconfigured successfully |
+-----------------------------------+
1 row in set (5.85 sec)

mcm> get -d log-name:ndb_mgmd mycluster;
+----------+----------+----------+---------+----------+---------+---------+--------------+
| Name     | Value    | Process1 | NodeId1 | Process2 | NodeId2 | Level   | Comment      |
+----------+----------+----------+---------+----------+---------+---------+--------------+
| log-name | MgmtSrvr | ndb_mgmd | 145     |          |         | Default | Command Line |
+----------+----------+----------+---------+----------+---------+---------+--------------+
1 row in set (0.10 sec)