4.3.3list packages命令

list packages [package_name] site_name

此命令列出已注册的包。它需要一个参数,即注册包的站点的名称,如本例所示:

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)

如果是 Windows 主机tonfiskflundra则包列表可能如下所示:

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

在刚刚显示的示例中,使用安装在host 和 at 上 yourpackage的 MySQL NDB Cluster 二进制文件 ;使用安装在两台主机上的 MySQL NDB Cluster 二进制文件。C:\cluster\ndb-host-10tonfiskC:\cluster\ndb-host-20flundramypackageC:\mysql

输出包含三列;这些在以下列表中进行了描述:

  • Package 包的名称。当一个包包含位于不同主机上不同位置的 MySQL NDB Cluster 安装时,这有时可能是空的(请参阅下一个示例)。

  • Path 指定主机上 MySQL NDB Cluster 安装目录(基本目录)的路径。这与用于创建或扩充程序包 --basedir 的命令中为选项指定的值相同。add package

    在 Windows 上,此列中显示的路径将所有反斜杠字符转换为正斜杠,就像必须对--basedir选项执行的操作一样(请参阅本节前面的示例)。

  • Hosts MySQL NDB Cluster 安装或安装所在的主机。

您可以过滤结果,以便通过在站点名称之前提供包名称来显示仅与单个包相关的信息,如下所示:

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

(有关用于创建 的命令,请参见第 4.3.1 节“add package命令”。) add packageyourpackage

When a package contains MySQL NDB Cluster installations using different base directories on different hosts, each unique combination of path and host is shown in its own row. However, the name of the package is displayed in the first row only; all rows that immediately follow this row and that do not contain the package name also relate to the same package whose name is shown in the first preceding row to display a package name. For example, consider the list packages command and output 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 |
|             | /usr/local/bin/mysql                  | flundra |
+-------------+---------------------------------------+---------+
3 rows in set (1.07 sec)

This output shows that there are two packages defined for the site named mysite; these packages are named yourpackage and mypackage. The package yourpackage consists of the MySQL NDB Cluster binaries in the directory /usr/local/ndb-host-10 on host tonfisk, and in the directory /usr/local/ndb-host-20 on host flundra. The package named mypackage consists of the MySQL NDB Cluster binaries in the directory /usr/local/mysql on host tonfisk, and in the directory /usr/local/bin/mysql on host flundra.

If you omit the site_name argument, the command fails with an error, as shown here:

mcm> list packages;
ERROR 6 (00MGR): Illegal number of operands