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.iniConfiguration variables set in a running MySQL server (SQL node) by using the SQL
SETstatement in themysql command-line client (or in another MySQL client application)Configuration options passed to MySQL NDB Cluster executable programs when invoking them
NoteConfiguration options passed tomysqld 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 asmysql.
MySQL Cluster Manager simplifies this configuration scheme by treating all 3 types of configuration data asattributes, 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 theDataMemory configuration parameter that is written in theconfig.ini file and then reading that file to find the value, you merely invoke the MySQL Cluster Managerget 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 asmore orless. If you wish to change the amount of data memory allocated to the data nodes, you can issue a MySQL Cluster Managerset (orreset) command; MySQL Cluster Manager then writes the desired value toconfig.ini. If—as is the case withDataMemory—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 asndbd ormysqld) 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 theset command) or reset a given attribute value to its default (using thereset 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 singleset orreset command. Once you have set or reset the value of a configuration attribute, this value persists until it is changed by executing anotherset orreset command.
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:)
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.
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”.)
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. Suchmandatory 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 isNodeId. 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 resetmcm> reset NodeId:ndbd:2 mycluster;ERROR 6007 (00MGR): Config attribute NodeId is mandatory and cannot be resetmcm> reset NodeId:mysqld:4 mycluster;ERROR 6007 (00MGR): Config attribute NodeId is mandatory and cannot be resetRead-only attributes. Aread-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 isHostName, 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 changedmcm> reset HostName:ndbd mycluster;ERROR 6008 (00MGR): Config attribute HostName is readonly and cannot be changedmcm> reset HostName:mysqld mycluster;ERROR 6008 (00MGR): Config attribute HostName is readonly and cannot be changedmcm> set HostName:ndb_mgmd mycluster;ERROR 6008 (00MGR): Config attribute HostName is readonly and cannot be changedmcm> set HostName:ndbd mycluster;ERROR 6008 (00MGR): Config attribute HostName is readonly and cannot be changedmcm> 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 theget command.
A listing of attribute properties also can be found in the output ofndb_config --configinfo --xml (seendb_config — Extract NDB Cluster Configuration Information); for more complete information, seeConfiguration of NDB Cluster.
MySQL Cluster Manager determines internally which attributes are considered read-only for reasons of cluster stability and performance. You can use theget 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 ormy.cnf). These include all the command-line options of thendb_mgmd,ndbd, andndbmtd nodes, as well asmysqld options listed inServer 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 theset andreset commands, and their values can be checked with theget command; they include:
Forndb_mgmd:
--log-name,--verboseForndbd andndbmtd:
--core-file,--verboseThemysqld
--core-fileoption.
These command-line-only attributes supported by theget,set, andreset commands are marked withCommand Line in theComment column of theget 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)