Documentation Home
MySQL Cluster Manager 8.4 User Manual
Related Documentation Download this Manual
PDF (US Ltr) - 1.4Mb
PDF (A4) - 1.4Mb


5.3.1 The add package Command

add package {--basedir=|-b }path
    [{--hosts=|-h }host_list] package_name

host_list:
    host[,host[,...]]

This command creates a new package, or, if the package named package_name already exists, this command extends the package definition.

The --basedir option (short form: -b) indicates the location of the MySQL NDB Cluster installation directory on the listed hosts, and is required. This must be the path to the top-level directory where the MySQL NDB Cluster software is located (for example, /usr/local/mysql), and should not include the MySQL NDB Cluster bin, libexec, or other subdirectory within the installation directory.

Hosts may be specified as a comma-separated list, using the --hosts option (short form: -h); however, this option is not required. If --hosts is omitted, the path is assumed to be valid for all hosts in the cluster that is created using this package (see Section 5.4.1, “The create cluster Command”).

Important
  • You cannot perform add package if you have not yet defined any sites (each host referenced in an add package command must be associated with a site). See Section 5.2.6, “The create site Command”, for more information about defining sites.

  • When a package is first added for a site with the add package command, whenever the --hosts option is used, the host list must contain the host for the mcmd agent to which the mcm client is currently connected, in order to allow the MySQL Cluster Manager to access the version information of the package.

Suppose we have two Linux hosts named tonfisk and flundra, and the MySQL NDB Cluster software is installed in /usr/local/mysql on both hosts. In this case, you can create a package named mypackage that accounts for both hosts as shown here:

mcm> add package --basedir=/usr/local/mysql mypackage;
+----------------------------+
| Command result             |
+----------------------------+
| Package added successfully |
+----------------------------+
1 row in set (0.71 sec)

When this package is used to create a cluster, the MySQL Cluster Manager knows that it should find the MySQL NDB Cluster software in the /usr/local/mysql directory on each of the hosts.

For options to MySQL Cluster Manager client command options having Windows paths as values, you must use forward slashes (/) in place of backslashes (\), so if tonfisk and flundra are Windows hosts where MySQL NDB Cluster has been installed to the directory C:\mysql, the corresponding add package command would look like this (with the --basedir option highlighted):

mcm> add package --basedir=c:/mysql mypackage;
+----------------------------+
| Command result             |
+----------------------------+
| Package added successfully |
+----------------------------+
1 row in set (0.71 sec)

In the example just given, we could also have issued the command as add package --basedir=/usr/local/mysql --hosts=tonfisk,flundra mypackage (or add package --basedir=c:/mysql --hosts=tonfisk,flundra mypackage on Windows) with the same result, but the --hosts option was not required, since the MySQL NDB Cluster software's location is the same on each host. Let us suppose, however, that the software is installed in /usr/local/ndb-host-10 on host tonfisk and in /usr/local/ndb-host-20 on host flundra. In this case, we must issue 2 separate commands, specifying the host as well as the base directory in each case, as shown here:

mcm> add package --basedir=/usr/local/ndb-host-10
   >   --hosts=tonfisk yourpackage;
+----------------------------+
| Command result             |
+----------------------------+
| Package added successfully |
+----------------------------+
1 row in set (0.68 sec)

mcm> add package --basedir=/usr/local/ndb-host-20
   >   --hosts=flundra yourpackage;
+----------------------------+
| Command result             |
+----------------------------+
| Package added successfully |
+----------------------------+
1 row in set (0.81 sec)

Assuming that both hosts belong to a site called mysite, you can verify that these packages have been created as desired using the list packages command, as shown here:

mcm> list packages mysite;
+-------------+---------------------------------------+-----------------+
| Package     | Path                                  | Hosts           |
+-------------+---------------------------------------+-----------------+
| yourpackage | /usr/local/ndb-host-10                | tonfisk         |
|             | /usr/local/ndb-host-20                | flundra         |
| mypackage   | /usr/local/mysql                      | tonfisk,flundra |
+-------------+---------------------------------------+-----------------+
3 rows in set (1.07 sec)

(For more information about this command, see Section 5.3.3, “The list packages Command”.)

It is possible to assign the same base directory (or directories) on the same host (or hosts) to multiple packages, as shown in this example, in which we assume that hosts tonfisk and flundra have previously been assigned to a site named mysite:

mcm> add package -b /usr/local/mysql-cluster mypackage;
+----------------------------+
| Command result             |
+----------------------------+
| Package added successfully |
+----------------------------+
1 row in set (1.41 sec)

mcm> add package -b /usr/local/mysql-cluster yourpackage;
+----------------------------+
| Command result             |
+----------------------------+
| Package added successfully |
+----------------------------+
1 row in set (1.58 sec)

mcm> list packages mysite;
+-------------+--------------------------+-----------------+
| Package     | Path                     | Hosts           |
+-------------+--------------------------+-----------------+
| mypackage   | /usr/local/mysql-cluster | tonfisk,flundra |
| yourpackage | /usr/local/mysql-cluster | tonfisk,flundra |
+-------------+--------------------------+-----------------+
2 rows in set (0.50 sec)
Note

When IPv6-enabled Windows systems are used as MySQL NDB Cluster hosts under MySQL Cluster Manager, you must reference these hosts using IPv4 addresses. Otherwise, MySQL Cluster Manager will be unable to connect to the agent processes on those hosts. See Section 6.1, “MySQL Cluster Manager Usage and Design Limitations”.