This section covers the commands used in the MySQL Cluster Manager for getting and setting values of various types used in MySQL 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 Cluster using MySQL Cluster configuration parameters and MySQL Server options and variables that you may already be familiar with.
Configuration attributes. Traditionally, when administering MySQL Cluster, it has been necessary to distinguish between 3 types of configuration data:
Configuration parameters set in the
MySQL 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 Cluster executable programs when invoking them
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 Cluster configuration parameter, a MySQL Server variable, or a command-line option used with one or more MySQL Cluster binary programs. It does this transparently, handling all necessary changes in a unified interface.
For example, suppose that you wish to know how much data memory is
allocated to the data nodes in a given MySQL 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 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 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 Cluster process.
Instance: This value is used for a specific instance of a MySQL Cluster process, the instance being identified by its MySQL Cluster node ID.
Default values are hard-coded into MySQL 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.
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 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. 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 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 (see
Section 3.5.1, “The get Command”).
A listing of attribute properties also can be found in the output of ndb_config --configinfo --xml (see ndb_config — Extract MySQL Cluster Configuration Information); for more more complete information, see MySQL Cluster Configuration.
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.
