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 Cluster 获取配置属性值。(请参阅 第 4.5 节,“MySQL 集群管理器配置命令”,了解术语“属性”在 MySQL 集群管理器中的定义。)输出包括以下列:
Name:此列包含配置属性的名称。Value:此列显示属性的当前值。Process1:此列包含属性适用的进程类型。这是ndb_mgmd,ndbd,ndbmtd(MySQL Cluster NDB 7.0 及更高版本)或mysqld.Id1:这是应用该属性的进程的进程 ID。Process2:对于需要指定两个节点的属性,例如与TCP/IP连接相关的属性,该栏显示第二个节点的进程类型。Id2:对于需要指定两个节点的属性,此列显示第二个节点的进程ID。Level:这是属性进程级别。此列中的值可以是Default、Process或为空;如果此列为空,则表示该属性适用于实例级别。Comment:此列用于显示属性是Mandatory、Read only、Default属性还是用户定义(在这种情况下该Comment列为空)。
默认情况下,get仅返回那些已明确设置的属性,这些属性由 MySQL 集群管理器本身或用户设置。换句话说,它只显示强制属性(包括只读属性),或者在创建集群后由用户设置的属性。在本次讨论的下文中,我们将这些称为“非默认属性”。
因此,在设置任何配置属性之前,您可以通过运行此命令的最简单形式来获取所有必需属性和只读属性的列表,如下所示:
mcm> get mycluster;
mcm> get mycluster\G
*************************** 1. row ***************************
Name: DataDir
Value: /home/jon/bin/mcm/mcm_data/clusters/mycluster/1/data
Process1: ndbmtd
NodeId1: 1
Process2:
NodeId2:
Level:
Comment:
*************************** 2. row ***************************
Name: HostName
Value: torsk
Process1: ndbmtd
NodeId1: 1
Process2:
NodeId2:
Level:
Comment: Read only
*************************** 3. row ***************************
Name: NodeId
Value: 1
Process1: ndbmtd
NodeId1: 1
Process2:
NodeId2:
Level:
Comment: Read only
*************************** 4. row ***************************
Name: DataDir
Value: /home/jon/bin/mcm/mcm_data/clusters/mycluster/2/data
Process1: ndbmtd
NodeId1: 2
Process2:
NodeId2:
Level:
Comment:
*************************** 5. row ***************************
Name: HostName
Value: torsk
Process1: ndbmtd
NodeId1: 2
Process2:
NodeId2:
Level:
Comment: Read only
*************************** 6. row ***************************
Name: NodeId
Value: 2
Process1: ndbmtd
NodeId1: 2
Process2:
NodeId2:
Level:
Comment: Read only
*************************** 7. row ***************************
Name: DataDir
Value: /home/jon/bin/mcm/mcm_data/clusters/mycluster/49/data
Process1: ndb_mgmd
NodeId1: 49
Process2:
NodeId2:
Level:
Comment:
*************************** 8. row ***************************
Name: HostName
Value: torsk
Process1: ndb_mgmd
NodeId1: 49
Process2:
NodeId2:
Level:
Comment: Read only
*************************** 9. row ***************************
Name: NodeId
Value: 49
Process1: ndb_mgmd
NodeId1: 49
Process2:
NodeId2:
Level:
Comment: Read only
...
*************************** 24. row ***************************
Name: ndbcluster
Value:
Process1: mysqld
NodeId1: 51
Process2:
NodeId2:
Level:
Comment: Read only
*************************** 25. row ***************************
Name: NodeId
Value: 51
Process1: mysqld
NodeId1: 51
Process2:
NodeId2:
Level:
Comment: Read only
*************************** 26. row ***************************
Name: port
Value: 3307
Process1: mysqld
NodeId1: 51
Process2:
NodeId2:
Level:
Comment:
*************************** 27. row ***************************
Name: socket
Value: /tmp/mysql.mycluster.51.sock
Process1: mysqld
NodeId1: 51
Process2:
NodeId2:
Level:
Comment:
*************************** 28. row ***************************
Name: tmpdir
Value: /home/jon/bin/mcm/mcm_data/clusters/mycluster/51/data/tmp
Process1: mysqld
NodeId1: 51
Process2:
NodeId2:
Level:
Comment:
*************************** 29. row ***************************
Name: NodeId
Value: 52
Process1: ndbapi
NodeId1: 52
Process2:
NodeId2:
Level:
Comment: Read only
29 rows in set (0.05 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: __ndbmt_classic
Value: NULL
Process1: ndbmtd
NodeId1: 1
Process2:
NodeId2:
Level: Default
Comment:
*************************** 2. row ***************************
Name: __ndbmt_lqh_threads
Value: NULL
Process1: ndbmtd
NodeId1: 1
Process2:
NodeId2:
Level: Default
Comment:
*************************** 3. row ***************************
Name: __ndbmt_lqh_workers
Value: NULL
Process1: ndbmtd
NodeId1: 1
Process2:
NodeId2:
Level: Default
Comment:
*************************** 4. row ***************************
Name: Arbitration
Value: Default
Process1: ndbmtd
NodeId1: 1
Process2:
NodeId2:
Level: Default
Comment:
*************************** 5. row ***************************
Name: ArbitrationTimeout
Value: 7500
Process1: ndbmtd
NodeId1: 1
Process2:
NodeId2:
Level: Default
Comment:
...
*************************** 1094. row ***************************
Name: DefaultOperationRedoProblemAction
Value: queue
Process1: ndbapi
NodeId1: 52
Process2:
NodeId2:
Level: Default
Comment:
*************************** 1095. row ***************************
Name: ExecuteOnComputer
Value: NULL
Process1: ndbapi
NodeId1: 52
Process2:
NodeId2:
Level: Default
Comment:
*************************** 1096. row ***************************
Name: HeartbeatThreadPriority
Value: NULL
Process1: ndbapi
NodeId1: 52
Process2:
NodeId2:
Level: Default
Comment:
*************************** 1097. row ***************************
Name: HostName
Value:
Process1: ndbapi
NodeId1: 52
Process2:
NodeId2:
Level: Default
Comment:
*************************** 1098. row ***************************
Name: MaxScanBatchSize
Value: 262144
Process1: ndbapi
NodeId1: 52
Process2:
NodeId2:
Level: Default
Comment:
*************************** 1099. row ***************************
Name: NodeId
Value: 52
Process1: ndbapi
NodeId1: 52
Process2:
NodeId2:
Level:
Comment: Read only
*************************** 1100. row ***************************
Name: TotalSendBufferMemory
Value: 0
Process1: ndbapi
NodeId1: 52
Process2:
NodeId2:
Level: Default
Comment:
*************************** 1101. row ***************************
Name: wan
Value: false
Process1: ndbapi
NodeId1: 52
Process2:
NodeId2:
Level: Default
Comment:
1101 rows in set (0.09 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)
要为给定类型的所有进程获取给定属性的值,您可以指定 : 形式的过滤
attribute_name器process_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_name器process_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)(刚刚显示的示例假定没有属性设置为非默认值。)
要获取进程的单个实例的所有非默认属性的列表,请使用具有 form 的过滤器
,如本例所示,它检索ndbd进程
的所有非默认属性,其进程 ID 为:
:process_name:process_id2
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)
如果您尝试获取您知道您的 MySQL 集群版本支持的属性的值,但结果为空,这几乎可以肯定这意味着它是一个默认属性,自集群创建以来未更改或已被更改重置。为了使用 get 查看默认属性,您必须使用
--include-defaults选项(简称
:)执行命令-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)
您可以看到,不仅命令输出Value
中的列get已更新为新值,而且该Level列也已从更新Default为
Process。这意味着您不再需要--include-defaults查看此属性的选项,如下所示:
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)
但是,如果您重置
DataMemory(也在进程级别),则不再是这种情况。然后,
DataMemory再次采用其默认值,之后您必须使用该
--include-defaults选项来检索它,如本例所示:
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)
有关这些命令的更多信息,请参阅
第 4.5.3 节“set命令”和第 4.5.2 节“reset命令”。
从 MySQL Cluster Manager 1.3.4 开始,该get命令还在
Comment列中标记多条目复制属性;例如:
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)
关于如何重置多条目属性,请参阅
第 4.5.2 节,“reset命令”。
该get命令通常不显示应用于 TCP 或 SHM 连接的配置属性。但是,可以在 MySQL Cluster Manager 客户端中设置此类属性(使用set命令);一旦它们被设置,它们就会通过适用的
get命令显示出来。请参阅
设置 TCP 连接属性,其中提供了一个示例。