4.5.1get命令

get [--include-defaults|-d] [filter_specification_list] cluster_name

filter_specification_list:
    filter_specification[,filter_specification][,...]

filter_specification:
    [attribute_name][:process_specification][+process_specification]]

process_specification:
    [process_name][:process_id]

process_name:
    {ndb_mgmd|ndbd|ndbmtd|mysqld|ndbapi}

此命令在 MySQL Cluster Manager 客户端中用于从 MySQL NDB Cluster 获取配置属性值。(请参阅 第 4.5 节,“MySQL 集群管理器配置命令”,了解术语属性在 MySQL 集群管理器中的定义。)输出包括以下列:

  • Name:此列包含配置属性的名称。

  • Value:此列显示属性的当前值。

  • Process1:此列包含属性适用的进程类型。这是 ndb_mgmd, ndbd, ndbmtd(MySQL NDB Cluster 7.0 及更高版本)或 mysqld.

  • Id1:这是应用该属性的进程的进程 ID。

  • Process2:对于需要指定两个节点的属性,例如与TCP/IP连接相关的属性,该栏显示第二个节点的进程类型。

  • Id2:对于需要指定两个节点的属性,此列显示第二个节点的进程ID。

  • Level:这是属性进程级别。此列中的值可以是 DefaultProcess或为空;如果此列为空,则表示该属性适用于实例级别。

  • Comment:此列用于显示属性是MandatoryRead onlyDefault 属性还是用户定义(在这种情况下该 Comment列为空)。

默认情况下,get仅返回那些已明确设置的属性,这些属性由 MySQL 集群管理器本身或用户设置。换句话说,它只显示强制属性(包括只读属性),或者在创建集群后由用户设置的属性。在本次讨论的下文中,我们将这些称为非默认属性

因此,在设置任何配置属性之前,您可以通过运行此命令的最简单形式来获取所有必需属性和只读属性的列表,如下所示:

mcm> get mycluster\G
*************************** 1. row ***************************
    Name: Name
   Value: mycluster
Process1:
 NodeId1:
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 2. row ***************************
    Name: DataDir
   Value: /opt/mcm_data/clusters/mycluster/49/data
Process1: ndb_mgmd
 NodeId1: 49
Process2:
 NodeId2:
   Level:
 Comment:
*************************** 3. row ***************************
    Name: HostName
   Value: torsk
Process1: ndb_mgmd
 NodeId1: 49
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 4. row ***************************
    Name: NodeId
   Value: 49
Process1: ndb_mgmd
 NodeId1: 49
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 5. row ***************************
    Name: PortNumber
   Value: 1186
Process1: ndb_mgmd
 NodeId1: 49
Process2:
 NodeId2:
   Level: Process
 Comment:
*************************** 6. row ***************************
    Name: DataDir
   Value: /opt/mcm_data/clusters/mycluster/1/data
Process1: ndbmtd
 NodeId1: 1
Process2:
 NodeId2:
   Level:
 Comment:
*************************** 7. row ***************************
    Name: HostName
   Value: torsk
Process1: ndbmtd
 NodeId1: 1
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 8. row ***************************
    Name: NodeId
   Value: 1
Process1: ndbmtd
 NodeId1: 1
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 9. row ***************************
    Name: DataDir
   Value: /opt/mcm_data/clusters/mycluster/2/data
Process1: ndbmtd
 NodeId1: 2
Process2:
 NodeId2:
   Level:
 Comment:
*************************** 10. row ***************************
    Name: HostName
   Value: torsk
Process1: ndbmtd
 NodeId1: 2
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 11. row ***************************
    Name: NodeId
   Value: 2
Process1: ndbmtd
 NodeId1: 2
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 12. row ***************************
    Name: datadir
   Value: /opt/mcm_data/clusters/mycluster/50/data
Process1: mysqld
 NodeId1: 50
Process2:
 NodeId2:
   Level:
 Comment:
*************************** 13. row ***************************
    Name: default_storage_engine
   Value: ndbcluster
Process1: mysqld
 NodeId1: 50
Process2:
 NodeId2:
   Level: Process
 Comment:
*************************** 14. row ***************************
    Name: HostName
   Value: torsk
Process1: mysqld
 NodeId1: 50
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 15. row ***************************
    Name: ndb_nodeid
   Value: 50
Process1: mysqld
 NodeId1: 50
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 16. row ***************************
    Name: ndbcluster
   Value: on
Process1: mysqld
 NodeId1: 50
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 17. row ***************************
    Name: NodeId
   Value: 50
Process1: mysqld
 NodeId1: 50
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 18. row ***************************
    Name: port
   Value: 3306
Process1: mysqld
 NodeId1: 50
Process2:
 NodeId2:
   Level:
 Comment:
*************************** 19. row ***************************
    Name: socket
   Value: /tmp/mysql.mycluster.50.sock
Process1: mysqld
 NodeId1: 50
Process2:
 NodeId2:
   Level:
 Comment:
*************************** 20. row ***************************
    Name: tmpdir
   Value: /opt/mcm_data/clusters/mycluster/50/tmp
Process1: mysqld
 NodeId1: 50
Process2:
 NodeId2:
   Level:
 Comment:
*************************** 21. row ***************************
    Name: datadir
   Value: /opt/mcm_data/clusters/mycluster/51/data
Process1: mysqld
 NodeId1: 51
Process2:
 NodeId2:
   Level:
 Comment:
*************************** 22. row ***************************
    Name: default_storage_engine
   Value: ndbcluster
Process1: mysqld
 NodeId1: 51
Process2:
 NodeId2:
   Level: Process
 Comment:
*************************** 23. row ***************************
    Name: HostName
   Value: torsk
Process1: mysqld
 NodeId1: 51
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 24. row ***************************
    Name: ndb_nodeid
   Value: 51
Process1: mysqld
 NodeId1: 51
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 25. row ***************************
    Name: ndbcluster
   Value: on
Process1: mysqld
 NodeId1: 51
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 26. row ***************************
    Name: NodeId
   Value: 51
Process1: mysqld
 NodeId1: 51
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 27. row ***************************
    Name: port
   Value: 3307
Process1: mysqld
 NodeId1: 51
Process2:
 NodeId2:
   Level:
 Comment:
*************************** 28. row ***************************
    Name: socket
   Value: /tmp/mysql.mycluster.51.sock
Process1: mysqld
 NodeId1: 51
Process2:
 NodeId2:
   Level:
 Comment:
*************************** 29. row ***************************
    Name: tmpdir
   Value: /opt/mcm_data/clusters/mycluster/51/tmp
Process1: mysqld
 NodeId1: 51
Process2:
 NodeId2:
   Level:
 Comment:
*************************** 30. row ***************************
    Name: NodeId
   Value: 52
Process1: ndbapi
 NodeId1: 52
Process2:
 NodeId2:
   Level:
 Comment: Read only
30 rows in set (0.07 sec)

get 在 Windows 上,不执行命令 报告的路径值中使用的反斜杠或其他字符的替换。set但是,如果使用命令设置值,则可能会看到在此类路径中使用的正斜杠 。有关详细信息,请参阅 在 Windows 上设置包含路径的属性

尽管在上一个示例的输出中显示了节点的socket属性 并且未标记为,但 MySQL Cluster Manager 不支持 Windows 上的套接字文件。为此原因; 您不应尝试 使用 MySQL Cluster Manager为 Windows 进程设置属性。 mysqldgetRead onlysocketmysqld

要包括尚未(或尚未)显式设置的属性的默认值,您可以使用 --include-defaults选项(缩写形式 :)调用此命令-d,如下所示(部分):

mcm> get --include-defaults mycluster\G
*************************** 1. row ***************************
    Name: Name
   Value: mycluster
Process1:
 NodeId1:
Process2:
 NodeId2:
   Level:
 Comment: Read only
*************************** 2. row ***************************
    Name: Checksum
   Value: false
Process1: ndb_mgmd
 NodeId1: 49
Process2: ndbmtd
 NodeId2: 1
   Level: Default
 Comment:
*************************** 3. row ***************************
    Name: Group
   Value: 55
Process1: ndb_mgmd
 NodeId1: 49
Process2: ndbmtd
 NodeId2: 1
   Level: Default
 Comment:
*************************** 4. row ***************************
    Name: HostName1
   Value: NULL
Process1: ndb_mgmd
 NodeId1: 49
Process2: ndbmtd
 NodeId2: 1
   Level: Default
 Comment:
*************************** 5. row ***************************
    Name: HostName2
   Value: NULL
Process1: ndb_mgmd
 NodeId1: 49
Process2: ndbmtd
 NodeId2: 1
   Level: Default
 Comment:
*************************** 6. row ***************************
    Name: NodeId1
   Value: NULL
Process1: ndb_mgmd
 NodeId1: 49
Process2: ndbmtd
 NodeId2: 1
   Level: Default
 Comment: Mandatory
*************************** 7. row ***************************
    Name: NodeId2
   Value: NULL
Process1: ndb_mgmd
 NodeId1: 49
Process2: ndbmtd
 NodeId2: 1
   Level: Default
 Comment: Mandatory
*************************** 8. row ***************************
    Name: NodeIdServer
   Value: NULL
Process1: ndb_mgmd
 NodeId1: 49
Process2: ndbmtd
 NodeId2: 1
   Level: Default
 Comment: Mandatory
*************************** 9. row ***************************
    Name: OverloadLimit
   Value: 0
Process1: ndb_mgmd
 NodeId1: 49
Process2: ndbmtd
 NodeId2: 1
   Level: Default
 Comment:
*************************** 10. row ***************************
    Name: Proxy
   Value: NULL
Process1: ndb_mgmd
 NodeId1: 49
Process2: ndbmtd
 NodeId2: 1
   Level: Default
 Comment:
*************************** 11. row ***************************
    Name: ReceiveBufferMemory
   Value: 2097152
Process1: ndb_mgmd
 NodeId1: 49
Process2: ndbmtd
 NodeId2: 1
   Level: Default
 Comment:
*************************** 12. row ***************************
    Name: SendBufferMemory
   Value: 2097152
Process1: ndb_mgmd
 NodeId1: 49
Process2: ndbmtd
 NodeId2: 1
   Level: Default
 Comment:
*************************** 13. row ***************************
    Name: SendSignalId
   Value: true
Process1: ndb_mgmd
 NodeId1: 49
Process2: ndbmtd
 NodeId2: 1
   Level: Default
 Comment:
*************************** 14. row ***************************
    Name: TCP_MAXSEG_SIZE
   Value: 0
Process1: ndb_mgmd
 NodeId1: 49
Process2: ndbmtd
 NodeId2: 1
   Level: Default
 Comment:

...

*************************** 1901. row ***************************
    Name: StartConnectBackoffMaxTime
   Value: 0
Process1: ndbapi
 NodeId1: 52
Process2:
 NodeId2:
   Level: Default
 Comment:
*************************** 1902. row ***************************
    Name: TotalSendBufferMemory
   Value: 0
Process1: ndbapi
 NodeId1: 52
Process2:
 NodeId2:
   Level: Default
 Comment:
*************************** 1903. row ***************************
    Name: wan
   Value: false
Process1: ndbapi
 NodeId1: 52
Process2:
 NodeId2:
   Level: Default
 Comment:
1903 rows in set (0.11 sec)

如您所见,此get 命令的输出很长(并且生成的行数随着集群中节点数的增加而增加。)但是,可以过滤输出以便您只能查看一个或多个属性你感兴趣的。这可以通过使用一个或多个过滤器规范的逗号分隔列表来完成。过滤器规范的定义如下所示(从本节开头给出的内容浓缩而来,但实际上相同):

[attribute_name][:[process_name][:process_id]]

可以按属性、按流程类型和按流程实例应用过滤。我们现在提供一些示例来说明此类过滤器的使用。

要为集群中应用它的所有进程获取给定属性的值,您只需使用该属性的名称作为过滤器。例如,要获取 HostName名为 的集群中所有进程的mycluster,您可以执行此处显示的命令:

mcm> get HostName mycluster;
+----------+----------+----------+---------+----------+---------+-------+-----------+
| Name     | Value    | Process1 | NodeId1 | Process2 | NodeId2 | Level | Comment   |
+----------+----------+----------+---------+----------+---------+-------+-----------+
| HostName | flundra  | ndbd     | 1       |          |         |       | Read only |
| HostName | tonfisk  | ndbd     | 2       |          |         |       | Read only |
| HostName | grindval | ndb_mgmd | 49      |          |         |       | Read only |
| HostName | haj      | mysqld   | 50      |          |         |       | Read only |
| HostName | torsk    | mysqld   | 51      |          |         |       | Read only |
+----------+----------+----------+---------+----------+---------+-------+-----------+
5 rows in set (0.04 sec)

通配符*(星号字符)可用于匹配单个或多个属性名称;例如:

mcm> get Host* mycluster;
+----------+----------+----------+---------+----------+---------+-------+-----------+
| Name     | Value    | Process1 | NodeId1 | Process2 | NodeId2 | Level | Comment   |
+----------+----------+----------+---------+----------+---------+-------+-----------+
| HostName | flundra  | ndbd     | 1       |          |         |       | Read only |
| HostName | tonfisk  | ndbd     | 2       |          |         |       | Read only |
| HostName | grindval | ndb_mgmd | 49      |          |         |       | Read only |
| HostName | haj      | mysqld   | 50      |          |         |       | Read only |
| HostName | torsk    | mysqld   | 51      |          |         |       | Read only |
+----------+----------+----------+---------+----------+---------+-------+-----------+
5 rows in set (0.04 sec)
mcm> get H* yourcluster;
+------------------------+---------+----------+---------+----------+---------+---------+-----------+
| Name                   | Value   | Process1 | NodeId1 | Process2 | NodeId2 | Level   | Comment   |
+------------------------+---------+----------+---------+----------+---------+---------+-----------+
| HostName               | tonfisk | ndb_mgmd | 49      |          |         |         | Read only |
| HostName               | flundra | ndb_mgmd | 53      |          |         |         | Read only |
| HeartbeatIntervalDbApi | 1500    | ndbmtd   | 1       |          |         | Process |           |
| HeartbeatIntervalDbDb  | 1500    | ndbmtd   | 1       |          |         | Process |           |
| HostName               | tonfisk | ndbmtd   | 1       |          |         |         | Read only |
| HeartbeatIntervalDbApi | 1500    | ndbmtd   | 2       |          |         | Process |           |
| HeartbeatIntervalDbDb  | 1500    | ndbmtd   | 2       |          |         | Process |           |
| HostName               | flundra | ndbmtd   | 2       |          |         |         | Read only |
| HostName               | tonfisk | mysqld   | 50      |          |         |         | Read only |
| HostName               | flundra | mysqld   | 51      |          |         |         | Read only |
+------------------------+---------+----------+---------+----------+---------+---------+-----------+
10 rows in set (0.09 sec)

要为给定类型的所有进程获取给定属性的值,您可以指定 : 形式的过滤 attribute_nameprocess_name。以下命令检索集群HostName 中所有ndbd进程的(仅) mycluster

mcm> get HostName:ndbd mycluster;
+----------+---------+----------+------+----------+------+-------+----------+
| Name     | Value   | Process1 | Id1  | Process2 | Id2  | Level | Comment  |
+----------+---------+----------+------+----------+------+-------+----------+
| HostName | flundra | ndbd     | 1    |          |      |       | Readonly |
| HostName | tonfisk | ndbd     | 2    |          |      |       | Readonly |
+----------+---------+----------+------+----------+------+-------+----------+
2 rows in set (0.12 sec)

要为流程的特定实例检索给定属性的值,您可以使用采用 :: 形式的 attribute_name过滤process_nameprocess_id。例如,您可以使用以下命令获取具有2进程 ID 的进程的主机名:

mcm> get HostName:ndbd:2 mycluster;
+----------+---------+----------+------+----------+------+-------+----------+
| Name     | Value   | Process1 | Id1  | Process2 | Id2  | Level | Comment  |
+----------+---------+----------+------+----------+------+-------+----------+
| HostName | tonfisk | ndbd     | 2    |          |      |       | Readonly |
+----------+---------+----------+------+----------+------+-------+----------+
1 row in set (1.67 sec)

如果省略进程类型,该命令的作用相同:

mcm> get HostName::2 mycluster;
+----------+---------+----------+------+----------+------+-------+----------+
| Name     | Value   | Process1 | Id1  | Process2 | Id2  | Level | Comment  |
+----------+---------+----------+------+----------+------+-------+----------+
| HostName | tonfisk | ndbd     | 2    |          |      |       | Readonly |
+----------+---------+----------+------+----------+------+-------+----------+
1 row in set (1.67 sec)

get您可以通过指定过滤器列表(以逗号分隔) 在单个命令中获取有关多个属性的信息。列表中的每个过滤器都必须是完整、有效的过滤器。此处显示的命令检索 中所有进程的HostName和 : DataDirmycluster

mcm> get HostName,DataDir mycluster;
+----------+--------------+----------+---------+----------+---------+-------+-----------+
| Name     | Value        | Process1 | NodeId1 | Process2 | NodeId2 | Level | Comment   |
+----------+--------------+----------+---------+----------+---------+-------+-----------+
| DataDir  | /opt/c1data  | ndbd     | 1       |          |         |       |           |
| HostName | flundra      | ndbd     | 1       |          |         |       | Read only |
| DataDir  | /opt/c2data  | ndbd     | 2       |          |         |       |           |
| HostName | tonfisk      | ndbd     | 2       |          |         |       | Read only |
| DataDir  | /opt/c49data | ndb_mgmd | 49      |          |         |       |           |
| HostName | grindval     | ndb_mgmd | 49      |          |         |       | Read only |
| datadir  | /opt/c50data | mysqld   | 50      |          |         |       |           |
| HostName | haj          | mysqld   | 50      |          |         |       | Read only |
| datadir  | /opt/c51data | mysqld   | 51      |          |         |       |           |
| HostName | torsk        | mysqld   | 51      |          |         |       | Read only |
+----------+--------------+----------+---------+----------+---------+-------+-----------+
10 rows in set (0.05 sec)

要仅检索 中 数据节点的值HostName和 的值,您可以使用 此处显示的命令: DataDirmyclusterget

mcm> get HostName:ndbd,DataDir:ndbd mycluster;
+----------+-------------+----------+-----+----------+-----+-------+-----------+
| Name     | Value       | Process1 | Id1 | Process2 | Id2 | Level | Comment   |
+----------+-------------+----------+-----+----------+-----+-------+-----------+
| DataDir  | /opt/c2data | ndbd     | 1   |          |     |       |           |
| HostName | tonfisk     | ndbd     | 1   |          |     |       | Read only |
| DataDir  | /opt/c3data | ndbd     | 2   |          |     |       |           |
| HostName | flundra     | ndbd     | 2   |          |     |       | Read only |
+----------+-------------+----------+-----+----------+-----+-------+-----------+
4 rows in set (1.36 sec)

在刚刚显示的示例中,每个过滤器都包含一个进程类型说明符。如果您从其中一个过滤器中省略此说明符,您将获得您可能不会期望的结果:

mcm> get HostName,DataDir:ndbd mycluster;
+----------+-------------+----------+-----+----------+-----+-------+-----------+
| Name     | Value       | Process1 | Id1 | Process2 | Id2 | Level | Comment   |
+----------+-------------+----------+-----+----------+-----+-------+-----------+
| HostName | grindval    | ndb_mgmd | 49  |          |     |       | Read only |
| DataDir  | /opt/c2data | ndbd     | 1   |          |     |       |           |
| HostName | tonfisk     | ndbd     | 1   |          |     |       | Read only |
| DataDir  | /opt/c3data | ndbd     | 2   |          |     |       |           |
| HostName | flundra     | ndbd     | 2   |          |     |       | Read only |
| HostName | haj         | mysqld   | 50  |          |     |       | Read only |
| HostName | torsk       | mysqld   | 51  |          |     |       | Read only |
+----------+-------------+----------+-----+----------+-----+-------+-----------+
6 rows in set (0.58 sec)

过滤器列表HostName,DataDir:ndbd完全有效。然而,它实际上由过滤器组成, HostName换句话说 DataDir:ndbd,它意味着 “适用HostName所有进程, DataDir适用于 ndbd进程

假设您 希望 HostName获取 . _ 您可能想尝试使用类似于 过滤器列表的东西,但这不起作用,正如您在此处看到的: myclusterHostName:ndb_mgmd,mysqld

mcm> get HostName:ndb_mgmd,mysqld mycluster;
ERROR 6003 (00MGR): No such config variable mysqld for process

这是因为过滤器列表中的每个过滤器都必须是有效的过滤器,并且必须包含一个属性名称。(在刚刚显示的过滤器列表中,MySQL Cluster Manager 尝试将逗号后的第一个字符串解释为属性名称。)在用于检索 ndb_mgmd 和 mysqld 进程的命令中使用的正确过滤器 get列表显示 示例中: HostNamemycluster

mcm> get HostName:ndb_mgmd,HostName:mysqld mycluster;
+----------+----------+----------+------+----------+------+-------+-----------+
| Name     | Value    | Process1 | Id1  | Process2 | Id2  | Level | Comment   |
+----------+----------+----------+------+----------+------+-------+-----------+
| HostName | grindval | ndb_mgmd | 49   |          |      |       | Read only |
| HostName | haj      | mysqld   | 50   |          |      |       | Read only |
| HostName | torsk    | mysqld   | 51   |          |      |       | Read only |
+----------+----------+----------+------+----------+------+-------+-----------+
2 rows in set (0.21 sec)

还可以获得给定进程类型或进程实例的属性列表及其值。对于给定的流程类型,使用具有形式的过滤器 。例如,要检索应用于 名为的集群中的 ndbd进程的所有非默认属性,您可以使用过滤器 ,如下所示: :process_namemycluster:ndbd

mcm> get :ndbd mycluster;
+--------------+-------------+----------+-----+----------+-----+-------+-----------+
| Name         | Value       | Process1 | Id1 | Process2 | Id2 | Level | Comment   |
+--------------+-------------+----------+-----+----------+-----+-------+-----------+
| DataDir      | /opt/c2data | ndbd     | 1   |          |     |       |           |
| HostName     | tonfisk     | ndbd     | 1   |          |     |       | Read only |
| NodeId       | 1           | ndbd     | 1   |          |     |       | Read only |
| DataDir      | /opt/c3data | ndbd     | 2   |          |     |       |           |
| HostName     | flundra     | ndbd     | 2   |          |     |       | Read only |
| NodeId       | 2           | ndbd     | 2   |          |     |       | Read only |
+--------------+-------------+----------+-----+----------+-----+-------+-----------+
6 rows in set (0.77 sec)

(刚刚显示的示例假定没有属性设置为非默认值。)

To get a list of all non-default attributes for a single instance of a process, use a filter having the form :process_name:process_id, as shown in this example, which retrieves all non-default attributes for the ndbd process having 2 as its process ID:

mcm> get :ndbd:2 mycluster;
+--------------+-------------+----------+-----+----------+-----+-------+-----------+
| Name         | Value       | Process1 | Id1 | Process2 | Id2 | Level | Comment   |
+--------------+-------------+----------+-----+----------+-----+-------+-----------+
| DataDir      | /opt/c2data | ndbd     | 2   |          |     |       |           |
| HostName     | flundra     | ndbd     | 2   |          |     |       | Read only |
| NodeId       | 2           | ndbd     | 2   |          |     |       | Read only |
+--------------+-------------+----------+-----+----------+-----+-------+-----------+
4 rows in set (0.32 sec)

If you try to obtain values for an attribute that you know is supported by your MySQL NDB Cluster version, but the result is empty, this almost certainly means that it is a default attribute that either has not been changed since the cluster was created or has been reset. In order to view default attributes using get, you must execute the command using the --include-defaults option (short form: -d).

假设您想查看为名为 的集群中的ndbd进程 DataMemory配置 了多少 ,并且您执行了看似正确的命令,但返回了一个空结果,如下所示: myclusterget

mcm> get DataMemory:ndbd mycluster;
Empty set (1.19 sec)

这意味着该 DataMemory属性对于集群中的所有数据节点都有其默认值。如果您不记得这个值是什么,您可以通过添加 --include-defaults ( -d) 选项重复相同的命令来轻松确定它:

mcm> get --include-defaults DataMemory:ndbd mycluster;
+------------+----------+----------+-----+----------+-----+---------+---------+
| Name       | Value    | Process1 | Id1 | Process2 | Id2 | Level   | Comment |
+------------+----------+----------+-----+----------+-----+---------+---------+
| DataMemory | 83886080 | ndbd     | 1   |          |     | Default |         |
| DataMemory | 83886080 | ndbd     | 2   |          |     | Default |         |
+------------+----------+----------+-----+----------+-----+---------+---------+
2 rows in set (0.62 sec)

现在假设您将 DataMemory每个数据节点增加到 500 兆字节,然后重复该 get命令以验证新值:

mcm> set DataMemory:ndbd=500M mycluster;
+-----------------------------------+
| Command result                    |
+-----------------------------------+
| Cluster reconfigured successfully |
+-----------------------------------+
1 row in set (7.77 sec)

mcm> get --include-defaults DataMemory:ndbd mycluster;
+------------+-------+----------+-----+----------+-----+---------+---------+
| Name       | Value | Process1 | Id1 | Process2 | Id2 | Level   | Comment |
+------------+-------+----------+-----+----------+-----+---------+---------+
| DataMemory | 500M  | ndbd     | 1   |          |     | Process |         |
| DataMemory | 500M  | ndbd     | 2   |          |     | Process |         |
+------------+-------+----------+-----+----------+-----+---------+---------+
2 rows in set (1.46 sec)

You can see that, not only has the Value column in the get command output been updated to the new value, but the Level column has also been updated from Default to Process. This means that you no longer need the --include-defaults option to view this attribute, as shown here:

mcm> get DataMemory:ndbd mycluster;
+------------+-------+----------+-----+----------+-----+---------+---------+
| Name       | Value | Process1 | Id1 | Process2 | Id2 | Level   | Comment |
+------------+-------+----------+-----+----------+-----+---------+---------+
| DataMemory | 500M  | ndbd     | 1   |          |     | Process |         |
| DataMemory | 500M  | ndbd     | 2   |          |     | Process |         |
+------------+-------+----------+-----+----------+-----+---------+---------+
2 rows in set (0.63 sec)

However, if you reset DataMemory (also on the process level), this is no longer the case. Then, DataMemory once again assumes its default value, after which you must use the --include-defaults option to retrieve it, as shown in this example:

mcm> reset DataMemory:ndbd mycluster;
+-----------------------------------+
| Command result                    |
+-----------------------------------+
| Cluster reconfigured successfully |
+-----------------------------------+
1 row in set (7.65 sec)

mcm> get DataMemory:ndbd mycluster;
Empty set (1.76 sec)

mcm> get --include-defaults DataMemory:ndbd mycluster;
+------------+----------+----------+-----+----------+-----+---------+---------+
| Name       | Value    | Process1 | Id1 | Process2 | Id2 | Level   | Comment |
+------------+----------+----------+-----+----------+-----+---------+---------+
| DataMemory | 83886080 | ndbd     | 1   |          |     | Default |         |
| DataMemory | 83886080 | ndbd     | 2   |          |     | Default |         |
+------------+----------+----------+-----+----------+-----+---------+---------+
2 rows in set (1.01 sec)

For more information about these commands, see Section 4.5.3, “The set Command”, and Section 4.5.2, “The reset Command”.

The get command also tags multi-entry replication attributes as so in the Comment column; for example:

mcm> get replicate_ignore_table:mysqld mycluster;
+------------------------+--------------+----------+---------+----------+---------+---------+-------------+
| Name                   | Value        | Process1 | NodeId1 | Process2 |NodeId2  | Level   | Comment     |
+------------------------+--------------+----------+---------+----------+---------+---------+-------------+
| replicate_ignore_table | mydb.t1      | mysqld   | 50      |          |         |         | Multi-entry |
| replicate_ignore_table | mydb.t50     | mysqld   | 50      |          |         |         | Multi-entry |
| replicate_ignore_table | mydb.mytable | mysqld   | 50      |          |         | Process | Multi-entry |
| replicate_ignore_table | mydb.t51     | mysqld   | 51      |          |         |         | Multi-entry |
| replicate_ignore_table | mydb.mytable | mysqld   | 51      |          |         | Process | Multi-entry |
+------------------------+--------------+----------+---------+----------+---------+---------+-------------+
5 rows in set (0.05 sec)

On how to reset multi-entry attributes, see Section 4.5.2, “The reset Command”.

get命令通常不显示应用于 TCP 或 SHM 连接的配置属性。但是,可以在 MySQL Cluster Manager 客户端中设置此类属性(使用set命令);一旦它们被设置,它们就会通过适用的 get命令显示出来。请参阅 设置 TCP 连接属性,其中提供了一个示例。