4.1 Online Help and Information Commands

Online help is available in the MySQL Cluster Manager client for MySQL Cluster Manager client commands. The client can provide both general and command-specific information. In addition, you can obtain information about mysql client commands that are independent of the MySQL server and thus are also available for use when connected to the MySQL Cluster Manager agent.

Listing MySQL Cluster Manager client commands.  For a list of all commands with brief descriptions, use the list commands command, as shown here:

mcm> list commands;
+---------------------------------------------------------------------------+
| Help                                                                      |
+---------------------------------------------------------------------------+
| COMMANDS                                                                  |
|                                                                           |
| abort backup           Abort an ongoing cluster backup.                   |
| add hosts              Add hosts to site.                                 |
| add package            Add a package alias.                               |
| add process            Add cluster process.                               |
| backup cluster         Backup a cluster.                                  |
| change log-level       Change the log-level                               |
| change process         Change process type.                               |
| collect logs           Collect log files.                                 |
| create cluster         Create a cluster.                                  |
| create site            Create a site.                                     |
| delete cluster         Delete a cluster.                                  |
| delete package         Delete a package.                                  |
| delete site            Delete a site.                                     |
| get                    Get configuration variables.                       |
| import cluster         Import a running cluster.                          |
| import config          Import the configuration of a running cluster.     |
| list backups           List backup images.                                |
| list clusters          List all clusters.                                 |
| list commands          List the help text.                                |
| list hosts             List hosts in site.                                |
| list nextnodeids       List next nodeids to be allocated.                 |
| list packages          List all packages.                                 |
| list processes         List processes.                                    |
| list sites             List all sites.                                    |
| remove hosts           Remove hosts from site.                            |
| remove process         Remove a cluster process.                          |
| reset                  Reset configuration variables.                     |
| restart cluster        Restart a cluster.                                 |
| restore cluster        Restore a cluster.                                 |
| rotate log             Rotate the mcmd log.                               |
| set                    Set configuration variables.                       |
| show settings          Show agent settings.                               |
| show status            Show cluster, process, operation or backup status. |
| start cluster          Start a cluster.                                   |
| start process          Start a cluster process.                           |
| stop agents            Stop agents in site.                               |
| stop cluster           Stop a cluster.                                    |
| stop process           Stop a cluster process.                            |
| upgrade cluster        Upgrade a cluster.                                 |
| version                Print version information.                         |
|                                                                           |
| GLOBAL OPTIONS                                                            |
| Options that can be used with all commands                                |
|                                                                           |
|     --help|-?              Print detailed help.                           |
|                                                                           |
| Use '<COMMAND> --help' to see verbose help for individual commands.       |
+---------------------------------------------------------------------------+
49 rows in set (0.04 sec)

Obtaining information about specific MySQL Cluster Manager client commands.  To obtain more detailed help specific to a given command, invoke the command using the --help option, as shown in this example:

mcm> create site --help;
+-----------------------------------------------------------------------------+
| Help                                                                        |
+-----------------------------------------------------------------------------+
|                                                                             |
| create site [options] <sitename>                                            |
|                                                                             |
|       Creates a site from the hosts listed in --hosts.                      |
|                                                                             |
|       Required options:                                                     |
|       --hosts|-h           Comma separated list of hostnames.               |
|                            Format: --hosts = <host>[,<host>]*.              |
|                                                                             |
|       Valid options:                                                        |
|       --background|-B      Run command in background, and return prompt     | 
                             to the user immediately.                         |
|       --hosts|-h           Comma separated list of hostnames.               |
|                            Format: --hosts = <host>[,<host>]*.              |
+-----------------------------------------------------------------------------+
13 rows in set (0.00 sec)

For any MySQL Cluster Manager client command, the --help option may be abbreviated to -?:

mcm> list processes -?;
+-------------------------------------------------------------+
| Help                                                        |
+-------------------------------------------------------------+
|                                                             |
| list processes <sitename>                                   |
|                                                             |
|       Lists all processes defined in the specified cluster. |
+-------------------------------------------------------------+
4 rows in set (0.00 sec)

As mentioned elsewhere in this manual (see Chapter 4, MySQL Cluster Manager Client Commands), many other MySQL Cluster Manager command options have short forms as well. These are included in the documentation for each command. You can also find out what these are for a given command by invoking it with the --help or -? option.

You can obtain the release version of the MySQL Cluster Manager software in use from the output of the version command.

mysql client commands in the MySQL Cluster Manager client.  You can also use most standard mysql client commands in the MySQL Cluster Manager client (but not SQL statements, which depend on being connected to a MySQL server), such as prompt, quit, and status. For example, the output of the status command when connected to the MySQL Cluster Manager agent looks something like this (depending on the exact version of the client and agent which you are using and possibly other factors):

mcm> status
--------------
/home/jon/bin/mcm/libexec/../cluster/bin/mysql  
Ver 14.14 Distrib 5.6.23-ndb-7.4.4, for linux2.6 (x86_64) using EditLine wrapper

Connection id:          1
Current database:       <n/a>
Current user:           admin
SSL:                    Not in use
Current pager:          less
Using outfile:          ''
Using delimiter:        ;
Server version:         1.3.5 MySQL Cluster Manager
Protocol version:       10
Connection:             127.0.0.1 via TCP/IP
Server characterset:    <n/a>
Db     characterset:    <n/a>
Client characterset:    <n/a>
Conn.  characterset:    <n/a>
TCP port:               1862
--------------
Note

You may use the command delimiter with mysql client commands, but you are not required to do so. For instance, assuming that the delimiter in use was the default semicolon (;) character, we could have executed the status command like this:

mcm> status;
--------------
/home/jon/bin/mcm/cluster/bin/mysql  Ver 14.14 Distrib 5.6.23-ndb-7.4.4,...

A particularly useful mysql client command that you can also employ with mcm is the source command (short form: \.), which you can use for executing scripts containing MySQL Cluster Manager client commands. On a Linux system, you might have a text file in your home directory named get-attributes.mcm, whose contents are shown here:

get :ndb_mgmd mycluster\G
get :ndbd mycluster\G
get :mysqld mycluster\G

Assuming that you have created a cluster named mycluster, you can run this script in the client; the results vary according to how this cluster is actually configured, but should be similar to this:

mcm> \. ~/get-attributes.mcm
mcm> get :ndb_mgmd mycluster\G
*************************** 1. row ***************************
    Name: DataDir
   Value: /home/jon/bin/mcm/mcm_data/clusters/mycluster/49/data
Process1: ndb_mgmd
 NodeId1: 49
Process2:
 NodeId2:
   Level:
 Comment:
*************************** 2. row ***************************
    Name: HostName
   Value: flundra
Process1: ndb_mgmd
 NodeId1: 49
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 3. row ***************************
    Name: NodeId
   Value: 49
Process1: ndb_mgmd
 NodeId1: 49
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 4. row ***************************
    Name: PortNumber
   Value: 1186
Process1: ndb_mgmd
 NodeId1: 49
Process2:
 NodeId2:
   Level: Process
 Comment:
4 rows in set (0.09 sec)

mcm> get :ndbd mycluster\G
*************************** 1. row ***************************
    Name: DataDir
   Value: /home/jon/bin/mcm/mcm_data/clusters/mycluster/1/data
Process1: ndbd
 NodeId1: 1
Process2:
 NodeId2:
   Level:
 Comment:
*************************** 2. row ***************************
    Name: HostName
   Value: tonfisk
Process1: ndbd
 NodeId1: 1
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 3. row ***************************
    Name: NodeId
   Value: 1
Process1: ndbd
 NodeId1: 1
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 4. row ***************************
    Name: DataDir
   Value: /home/jon/bin/mcm/mcm_data/clusters/mycluster/2/data
Process1: ndbd
 NodeId1: 2
Process2:
 NodeId2:
   Level:
 Comment:
*************************** 5. row ***************************
    Name: HostName
   Value: grindval
Process1: ndbd
 NodeId1: 2
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 6. row ***************************
    Name: NodeId
   Value: 2
Process1: ndbd
 NodeId1: 2
Process2:
 NodeId2:
   Level:
 Comment: Read only
6 rows in set (0.10 sec)

mcm> get :mysqld mycluster\G
*************************** 1. row ***************************
    Name: datadir
   Value: /home/jon/bin/mcm/mcm_data/clusters/mycluster/50/data
Process1: mysqld
 NodeId1: 50
Process2:
 NodeId2:
   Level:
 Comment:
*************************** 2. row ***************************
    Name: HostName
   Value: haj
Process1: mysqld
 NodeId1: 50
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 3. row ***************************
    Name: log_error
   Value: /home/jon/bin/mcm/mcm_data/clusters/mycluster/50/data/mysqld_50_out.err
Process1: mysqld
 NodeId1: 50
Process2:
 NodeId2:
   Level:
 Comment:
*************************** 4. row ***************************
    Name: ndb_nodeid
   Value: 50
Process1: mysqld
 NodeId1: 50
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 5. row ***************************
    Name: ndbcluster
   Value:
Process1: mysqld
 NodeId1: 50
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 6. row ***************************
    Name: NodeId
   Value: 50
Process1: mysqld
 NodeId1: 50
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 7. row ***************************
    Name: port
   Value: 3306
Process1: mysqld
 NodeId1: 50
Process2:
 NodeId2:
   Level:
 Comment:
*************************** 8. row ***************************
    Name: socket
   Value: /tmp/mysql.mycluster.50.sock
Process1: mysqld
 NodeId1: 50
Process2:
 NodeId2:
   Level:
 Comment:
*************************** 9. row ***************************
    Name: tmpdir
   Value: /home/jon/bin/mcm/mcm_data/clusters/mycluster/50/data/tmp
Process1: mysqld
 NodeId1: 50
Process2:
 NodeId2:
   Level:
 Comment:
*************************** 10. row ***************************
    Name: datadir
   Value: /home/jon/bin/mcm/mcm_data/clusters/mycluster/51/data
Process1: mysqld
 NodeId1: 51
Process2:
 NodeId2:
   Level:
 Comment:
*************************** 11. row ***************************
    Name: HostName
   Value: torsk
Process1: mysqld
 NodeId1: 51
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 12. row ***************************
    Name: log_error
   Value: /home/jon/bin/mcm/mcm_data/clusters/mycluster/51/data/mysqld_51_out.err
Process1: mysqld
 NodeId1: 51
Process2:
 NodeId2:
   Level:
 Comment:
*************************** 13. row ***************************
    Name: ndb_nodeid
   Value: 51
Process1: mysqld
 NodeId1: 51
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 14. row ***************************
    Name: ndbcluster
   Value:
Process1: mysqld
 NodeId1: 51
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 15. row ***************************
    Name: NodeId
   Value: 51
Process1: mysqld
 NodeId1: 51
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 16. row ***************************
    Name: port
   Value: 3307
Process1: mysqld
 NodeId1: 51
Process2:
 NodeId2:
   Level:
 Comment:
*************************** 17. row ***************************
    Name: socket
   Value: /tmp/mysql.mycluster.51.sock
Process1: mysqld
 NodeId1: 51
Process2:
 NodeId2:
   Level:
 Comment:
*************************** 18. row ***************************
    Name: tmpdir
   Value: /home/jon/bin/mcm/mcm_data/clusters/mycluster/51/data/tmp
Process1: mysqld
 NodeId1: 51
Process2:
 NodeId2:
   Level:
 Comment:
18 rows in set (0.05 sec)
                 
mcm>                               
Note

You are not returned to the client prompt until the script has finished executing.

Similarly, on Windows, you can create a batch file using Notepad or another text editor, copy the same get commands as shown previously into it, and save it as get-attributes.bat in a convenient location such as the Windows desktop.

You can view a list of available mysql client commands using the help command. For more information about these, view the help output or see mysql Commands, in the MySQL Manual.