MySQL Cluster Manager 9.1 User Manual  /  Using MySQL Cluster Manager  /  mcmd, the MySQL Cluster Manager Agent

4.1 mcmd, the MySQL Cluster Manager Agent

mcmd is the MySQL Cluster Manager agent program. Invoking this executable starts the MySQL Cluster Manager Agent, to which you can connect using the mcm client (see Section 4.3, “Starting the MySQL Cluster Manager Client” and Chapter 5, MySQL Cluster Manager Client Commands for more information).

You can modify the behavior of the agent by specifying one or more of the options discussed in this section. Depending on the option of interest, there are up to three ways to set it:

  1. Include the option directly on the command line when invoking mcmd. This can be done for all options that has Yes under the Cmd-Line column in Table 4.1 MySQL Cluster Manager Agent (mcmd) Option Summary. Some options can only be specified by this method on the command line (for example, --config and --bootstrap).

    When specifying an agent configuration option on the command line using this method, the name of the option is prefixed with two leading dash characters (--); for example, --mcmd-user=johndoe. See the Command-Line Format for each option given in the option description table.

  2. Include the option in the agent configuration file. This can be done for all options that has Yes under the Option File column in Table 4.1 MySQL Cluster Manager Agent (mcmd) Option Summary. These rules apply:

    • The name of the option should not be prefixed with dashes, or any other characters.

    • Any hyphens in the option names should be changed to underscores.

    • The format of the configuration file follows that of the MySQL Router configuration file; see Configuration File Syntax for an explanation of the file format. An option must be specified in the correct section in the configuration file; see Table 4.1, “MySQL Cluster Manager Agent (mcmd) Option Summary” for which section each option belongs to.

    • Each option must be specified on a separate line. You can comment out a line by inserting a leading hash character (#).

  3. Any options configurable in the configuration file (i.e., by method 2 above), with the exception of mcmd_password, can be set or overridden at the mcmd command line by specifying the option in the format of --section_name.option=value, where section_name is name of the section in the configuration file that the option belongs to. For example, --mcmd.bind_port=12345 and --logger.level=DEBUG.

The following table contains a summary of agent options that are read on startup by mcmd. More detailed information about each of these options can be found in the option descriptions.

Table 4.1 MySQL Cluster Manager Agent (mcmd) Option Summary

Name Cmd-Line Option File Configuration File Section
bind_address - Yes mcmd
bind-port - Yes mcmd
bootstrap Yes - -
config Yes - -
copy-port - Yes mcmd
core-file Yes - -
data-folder Yes Yes DEFAULT
extra-config Yes - -
filename - Yes logger, syslog, filelog, eventlog
help Yes - -
initial Yes - -
level - Yes logger
logging_folder - Yes DEFAULT
max_total_connections - Yes DEFAULT
mcmd_password - Yes mcmd
mcmd-user - Yes mcmd
pid-file Yes Yes DEFAULT
sinks - Yes DEFAULT
ssl_ca - Yes mcmd
ssl_cert - Yes mcmd
ssl_cipher - Yes mcmd
ssl_key - Yes mcmd
ssl_mode - Yes mcmd
unknown_config_option - Yes DEFAULT
version Yes - -
xcom-port - Yes mcmd

MySQL Cluster Manager Agent (mcmd) Option Descriptions

The following list contains descriptions of each configuration option available for use with mcmd, including allowed and default values. Options with their Type unmentioned need only be specified in order to take effect— you should not try to set a value for them.

  • bind_address

    Type String
    Default Value 127.0.0.1

    Specify the address for MySQL Cluster Manager client connections. Binding to a specific IPv4 or IPv6 address ensures that mcmd is not starting on a network interface controller (NIC) on which nothing is allowed to execute.

    It is not possible to specify more than one bind address. Using :: binds all network interfaces (IPs) on the host.

    When set in the configuration file, the option should be put inside the [mcmd] section.

  • bind-port=#

    Type Numeric
    Default Value 1862
    Minimum Value 1
    Maximum Value 65535

    Specify the port used by MySQL Cluster Manager client connections. Any valid TC/IP port number can be used. Normally, there is no need to change it from the default value (1862).

  • --bootstrap, -B

    Command-Line Format --bootstrap

    Start the agent with default configuration values, create a default one-machine cluster named mycluster in a site named mysite, and start it. This option works only if no sites have been created yet.

  • --config=filename, -c

    Command-Line Format --config=file_name
    Type File name
    Default Value mcmd.conf, in the MCM installation directory

    Set the file from which to read configuration options. mcmd.conf in the installation directory of MySQL Cluster Manager is the first default location mcmd looks for the file. See Section 3.4, “MySQL Cluster Manager Configuration File” for more information.

  • copy-port

    Type Numeric
    Default Value 0
    Minimum Value 0
    Maximum Value 65535

    Allows you to specify the port for file copy operations. The default is 0.

  • --core-file

    Command-Line Format --core-file[=value]
    Type Boolean
    Default Value 1
    Valid Values

    1 (Write a core file)

    0 (Do not write a core file)

    Write a core file to the location where mcmd was started (or to another core dump location as specified by the operating system) when mcmd quits unexpectedly. The default value is 1.

  • --data-folder=dir_name, -d dir_name

    Command-Line Format --data-folder=dir_name
    Type Directory name
    Default Value mcm_data in the parent directory of the MCM installation directory

    Set the location of the agent repository, which contains collections of MySQL Cluster Manager data files and MySQL NDB Cluster configuration and data files. The value must be a valid absolute path.

    The default location is mcm_data in the parent directory of the MySQL Cluster Manager installation directory. If you change the default, you should use a standard location external to the MySQL Cluster Manager installation directory, such as /var/opt/mcm on Linux.

    In addition to the data files for all the clusters under the control of MySQL Cluster Manager, the data-folder also contains a rep directory in which mcmd configuration and metadata are kept. Normally, there is no need to interact with these directories beyond specifying the --data-folder option; see exceptions in, for example, Section 4.8, “Restoring a MySQL Cluster Manager Agent with Data from Other Agents” and Section 4.7, “Backing Up and Restoring MySQL Cluster Manager Agents”.

  • --extra-config=filename , -a

    Command-Line Format --extra-config=file_name
    Type File name

    Read this file after configuration files are read from either default locations or from the location specified by the --config option. Multiple --extra-config options can be passed, and the files are loaded in the order they are specified.

  • filename=filename

    Type File name
    Default Value mcmd.log

    Set the name of the file to write the log to. The default is mcmd.log, located in the same directory where the MySQL Cluster Manager installation directory is found. The location of this file can be overridden with the logging_folder option.

  • --help, -?

    Command-Line Format --help

    mcmd help output provides information on some file paths and all the program options; it also provides some usage examples of the mcmd command:

    $> mcmd --help
    MySQL Cluster Manager  v9.1.0 on linux-glibc2.17 (64-bit) (MySQL Enterprise - Commercial)
    Copyright (c) 2007, 2024, Oracle and/or its affiliates.
    
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Configuration read from the following files in the given order (enclosed
    in parentheses means not available for reading):
      (/opt/mcm9.1.0/bin/.././mcmd.conf)
      (/opt/mcm9.1.0/bin/.././mcmd.ini)
      (/home/johndoe/.mcmd.conf)
      (/home/johndoe/.mcmd.ini)
    Plugins Path:
      /opt/mcm9.1.0/lib/mysqlrouter
    
    Default Log Directory:
      /opt
    
    Default Persistent Data Directory:
      /opt/mcm_data
    
    Default Runtime State Directory:
      /opt
    
    
    # Usage
    
    mcmd (-?|--help)
    
    mcmd (-V|--version)
    
    mcmd [-B|--bootstrap] [-c|--config=<path>] [--core-file=[<0|1>]]
         [-d|--data-folder=<directory>] [-a|--extra-config=<path>]
         [-i|--initial] [--pid-file=<pidfile>]
    
    mcmd [--bind-port=<portnumber>] [--copy-port=<portnumber>]
         [--mcmd-user=<username>] [--xcom-port=<portnumber>]
    
    # Options
    
      -B, --bootstrap
            Bootstrap a MySQL Cluster using MySQL Cluster Manager
      -c <path>, --config <path>
            Only read configuration from given file.
      --core-file [ <0|1>]
            Write a core file if mcmd dies.
      -d <directory>, --data-folder <directory>
            Data directory for MySQL Cluster Manager.
      -a <path>, --extra-config <path>
            Read this file after configuration files are read from either
            default locations or from files specified by the --config
            option.
      -?, --help
            Display this help and exit.
      -i, --initial
            Reinitialize configuration metadata directory
      --pid-file <pidfile>
            Path and filename of pid file
      -V, --version
            Display version information and exit.
      --bind-port <portnumber>
            Portnumber to use for mcmd. [DEPRECATED]
      --copy-port <portnumber>
            Portnumber to use for file copying. [DEPRECATED]
      --mcmd-user <username>
            The username used to access MySQL Cluster Manager [DEPRECATED]
      --xcom-port <portnumber>
            Portnumber to use for XCOM. [DEPRECATED]
    
    # Examples
    
    Bootstrap a NDB cluster on localhost
    
        mcmd --bootstrap 
    
    Bootstrap a NDB cluster with a specified mcm_data directory
    
        mcmd --bootstrap -d my_mcm_data
    
    Start mcmd with additional config file options on cmdline
    
        mcmd --logger.level=NOTE --mcmd.copy_port=12345
  • --initial, -i

    Command-Line Format --initial

    After making a backup of the agent's configuration store (mcm_data/rep/) like the backup agents command would do for the local host, wipe the configuration store's contents before starting mcmd. The agent's configuration is then recovered from other agents. This is useful when an agent has fallen into an inconsistent state and cannot be properly restarted.

  • level=level

    Type Enumeration
    Default Value info
    Valid Values

    fatal

    system

    error

    warning

    info

    note

    debug

    Sets the mcmd log severity level. Possible values for this option and their descriptions are listed in Table 4.2, “MySQL Cluster Manager Agent Log Levels” in descending level of severity. When the option is set to a certain severity level, all events of that or higher levels are logged. info is the default log level, and is the recommended setting for a production environment; running on a more severe log level produces fewer messages and makes it harder to trace a problem when it occurs.

    Table 4.2 MySQL Cluster Manager Agent Log Levels

    Level of Severity Description
    fatal Conditions that should be corrected immediately, such as a corrupted MySQL Cluster Manager data repository
    system Informational messages about the product
    error Conditions that should be corrected, such as configuration errors
    warning Conditions that do not fail executions, but may require user attention
    info Messages on main events of the site and from command execution (default)
    note Informational messages to provide users with some execution details
    debug Debugging messages that give execution details useful for developers. This causes large log files if used over a long period of time.

    While the setting of the level option is applied only to the host whose mcmd agent uses the option, the change log-level client command can be used to apply the logging level to an entire management site or to specific hosts.

  • logging_folder=dir_name

    Type Directory name
    Default Value The parent directory of the MCM installation directory

    Path to the mcmd log file directory. The default is the parent directory of the MySQL Cluster Manager installation directory.

  • max_total_connections

    Type Integer
    Default Value 512
    Minimum Value 1
    Maximum Value 9223372036854775807

    The maximum number of client connections to mcmd. Setting this option helps prevent mcmd from running out of file descriptors. This is similar to MySQL Server's max_connections system variable.

    The default value is 512, and the option is set in the [DEFAULT] section of the configuration file.

  • mcmd_password=password

    The option serves the following two purposes:

    • Sets the user password for an mcm client to connect to the mcmd agent with the user name set by --mcmd-user. If the option is not specified, the default value of super is used. If the option is specified with another value, the client must supply it using the --password client option when trying to connect to the agent.

    • Sets a password for the MySQL account to be used by the mcmd agent to access the SQL nodes. When an SQL node is initialized, the mcmd agent creates a new MySQL user account on it using the user name set by the --mcmd-user option and the password set by this option. See descriptions of --mcmd-user for more details about the account.

      If the option is not specified, the default value of super is used.

    • When using TLS connections for NDB clusters, the password is also used as the certificate passphrase. If you changed the password, you must also update manually the certificate passphrase, or the TLS connections will fail. Alternatively, if the situation allows, you can disable TLS connections for the cluster, recreate the certificates, and then reanable TLS connections.

    The option can only be set in the [mcmd] section of configuration file, not on the command line.

  • mcmd-user=user_name

    The option serves the following two purposes:

    • Sets the user name for an mcm client to connect to the mcmd agent. If the option is not specified, the default value of mcmd is used. If the option is specified with another value, the client must supply it using the --user client option when trying to connect to the agent.

      The password for using this user name to connect to the agent is set with the mcmd_password option.

    • Sets a user name for the MySQL account to be used by the mcmd agent to access the SQL nodes. When an SQL node is initialized, the mcmd agent creates a new MySQL user account on it using the user name set by the option and the password set by the mcmd_password option. This account is created with all privileges on the MySQL server including the granting of privileges. In other words, it is created as if you had executed GRANT ALL PRIVILEGES ON *.* ... WITH GRANT OPTION in the mysql client. The existing MySQL root account is not altered in such cases, and the default test database is preserved.

    If the option is not specified, the default value of mcmd is used.

  • --pid-file=file

    Command-Line Format --pid-file=file_name
    Type File name
    Default Value mcmd.pid

    Set the name and path to a process ID (.pid) file. Not normally used or needed. This option is not supported on Windows systems.

  • sinks

    Type String
    Valid Values (Windows)

    consolelog

    filelog

    eventlog

    Valid Values (Other)

    consolelog

    filelog

    syslog

    The different logging methods used by mcmd.

    Supported sink values are: consolelog, filelog, eventlog (on Windows only), and syslog (on Unix-based systems only). Use a comma-separated list to define multiple values. If you have multiple sinks defined, they can be customized under the corresponding sections of [syslog], [filelog], and [eventlog] in the configuration file using the filename and level options.

    Default value: filelog if the logging_folder option is not empty in the [DEFAULT] section, and consolelog otherwise.

  • ssl_ca

    Type File name
    Default Value NULL

    The path name of the Certificate Authority (CA) certificate file in PEM format. The file contains a list of trusted SSL Certificate Authorities.

  • ssl_cert

    Type File name
    Default Value NULL

    The path name of the SSL public key certificate file in PEM format.

    If ssl_cert is set to a certificate that uses any restricted cipher or cipher category, mcmd starts with support for encrypted connections disabled. For information about cipher restrictions, see Connection Cipher Configuration.

  • ssl_cipher

    Type String
    Default Value NULL

    The list of permissible encryption ciphers for connections that use TLS protocol TLSv1.2. If no cipher in the list is supported, encrypted connections that use these TLS protocols do not work.

    For greatest portability, the cipher list should be a list of one or more cipher names, separated by colons. The following example shows two cipher names separated by a colon:

    [mcmd]
    ssl_cipher="DHE-RSA-AES128-GCM-SHA256:AES128-SHA"

    OpenSSL supports the syntax for specifying ciphers described in the OpenSSL documentation at https://www.openssl.org/docs/manmaster/man1/ciphers.html.

    For information about which encryption ciphers MySQL supports, see Encrypted Connection TLS Protocols and Ciphers.

  • ssl_key

    Type File name
    Default Value NULL

    The path name of the server SSL private key file in PEM format. For better security, use a certificate with an RSA key size of at least 2048 bits.

  • ssl_mode

    Type Enumeration
    Default Value PREFERRED
    Valid Values

    DISABLED

    REQUIRED

    PREFERRED

    ssl_mode sets the security state of the connections. The possible values are as follows:

    DISABLED

    Establish an unencrypted connection (the default if certificate and key have not been set).

    REQUIRED

    Establish a secure connection if the secure connections are supported by the target of connection.

    PREFERRED

    Establish an encrypted connection if the target of connection supports encrypted connections, falling back to an unencrypted connection if an encrypted connection cannot be established. This is the default if ssl_mode is not specified.

  • unknown_config_option=string

    Type String
    Default Value error
    Valid Values

    error

    warning

    Determines the behavior for handling unknown configuration options, such as those containing typos. Here are the values this option takes:

    • error (default): mcmd returns an error when an unknown option is encountered

    • warning: mcmd prints a warning when an unknown option is encountered and continues with starting

    MySQL Cluster Manager versions before 8.0.29 ignore any unknown configuration options.

  • --version, -V

    Command-Line Format --version

    Display version information and exit. Output may vary according to the MySQL Cluster Manager software version, operating platform, and versions of libraries used on your system, but should closely resemble what is shown here, with the first line of output containing the MySQL Cluster Manager release number:

    $> mcmd  --version
    MySQL Cluster Manager  v9.1.0 on linux-glibc2.17 (64-bit) (MySQL Enterprise - Commercial)
  • xcom-port

    Type Numeric
    Default Value 18620
    Minimum Value 1
    Maximum Value 65535

    Specify the XCOM port. The default in 18620.