add package {--basedir=|-b }path [{--hosts=|-h }host_list]package_namehost_list:host[,host[,...]] This command creates a new package, or, if the package namedpackage_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 shouldnot include the MySQL NDB Clusterbin,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, thepath is assumed to be valid for all hosts in the cluster that is created using this package (seeSection 5.4.1, “Thecreate cluster Command”).
You cannot perform
add packageif you have not yet defined any sites (each host referenced in anadd packagecommand must be associated with a site). SeeSection 5.2.6, “Thecreate siteCommand”, for more information about defining sites.When a package is first added for a site with the
add packagecommand, whenever the--hostsoption is used, the host list must contain the host for themcmd agent to which themcm 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 namedtonfisk andflundra, and the MySQL NDB Cluster software is installed in/usr/local/mysql on both hosts. In this case, you can create a package namedmypackage 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 iftonfisk andflundra are Windows hosts where MySQL NDB Cluster has been installed to the directoryC:\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 asadd package --basedir=/usr/local/mysql --hosts=tonfisk,flundra mypackage (oradd 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 hosttonfisk and in /usr/local/ndb-host-20 on hostflundra. 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 calledmysite, you can verify that these packages have been created as desired using thelist 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, seeSection 5.3.3, “Thelist 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 hoststonfisk andflundra have previously been assigned to a site namedmysite:
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)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. SeeSection 6.1, “MySQL Cluster Manager Usage and Design Limitations”.