4.5.2reset命令

reset 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 进程的名称。要在实例级别重置配置属性,请使用 形式的过滤器规范 ,其中是进程 ID。 attribute_name:process_nameattribute_nameprocess_nameattribute_name:process_name:process_idprocess_id

无论进程类型如何,您都不能发出reset重置给定配置属性的所有值的命令;每个reset命令都必须指定进程类型或进程实例。否则,命令将失败,如下所示:

mcm> reset DataMemory mycluster;
ERROR 3 (00MGR): Illegal syntax

您也不能使用单个过滤器规范恢复给定流程类型或流程实例的所有配置属性;您必须始终包含要重置的属性的名称。否则,reset命令将失败,如下所示:

mcm> reset :ndbd mycluster;
ERROR 3 (00MGR): Illegal syntax

mcm> reset :ndbd:3 mycluster;
ERROR 3 (00MGR): Illegal syntax

假设集群中所有ndbd 进程的数据内存mycluster已设置为 500 MB,如以下 get命令的输出所示:

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

我们可以从Level 列中 的条目中看到,两个ndbdDataMemory进程的设置都适用于进程级别。无法在实例级别重置进程级别设置,如下所示:

mcm> reset DataMemory:ndbd:2 mycluster;
ERROR 6010 (00MGR): No matching user defined setting was
found for config attribute DataMemory
mcm> reset DataMemory:ndbd:3 mycluster;
ERROR 6010 (00MGR): No matching user defined setting was
found for config attribute DataMemory

以下reset命令也不起作用,尽管您可能认为它会这样做,因为它试图为两个 ndbd进程重置属性值:

mcm> reset DataMemory:ndbd:2,DataMemory:ndbd:3 mycluster;
ERROR 6010 (00MGR): No matching user defined setting was
found for config attribute DataMemory

前面的命令失败,因为 MySQL 集群管理器将此视为应用两个实例级配置更改的尝试。因为该DataMemory 设置是进程级别的设置,所以您必须在进程级别重置 DataMemory为默认值;您可以通过DataMemory:ndbdreset命令中使用过滤器规范来执行此操作,如下所示:

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

如果您执行与get之前所示相同的命令,结果现在为空:

mcm> get DataMemory mycluster;
Empty set (0.74 sec)

这是因为默认情况下该get命令不报告默认值。DataMemory要在重置值后检索 值,您必须get使用 --include-defaults(short form: -d) 选项调用:

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

这些DataMemory值现在包含在输出中,并用列中的单词 Default标记Comments

现在假设在名为 named 的集群 中具有 ID 的 mysqld进程的mysqld配置属性先前已设置为此处所示的值,并且没有对该属性进行其他更改: wait_timeout4mycluster200

mcm> set wait_timeout:mysqld:4=200 mycluster;
+-----------------------------------+
| Command result                    |
+-----------------------------------+
| Cluster reconfigured successfully |
+-----------------------------------+
1 row in set (7.78 sec)

mcm> get -d wait_timeout:mysqld:4 mycluster;
+--------------+-------+----------+-----+----------+-----+-------+---------+
| Name         | Value | Process1 | Id1 | Process2 | Id2 | Level | Comment |
+--------------+-------+----------+-----+----------+-----+-------+---------+
| wait_timeout | 200   | mysqld   | 4   |          |     |       |         |
+--------------+-------+----------+-----+----------+-----+-------+---------+
1 row in set (0.98 sec)

因为该Level列是空的,所以我们知道此设置适用于实例级别。如果您尝试在进程级别重置它,尝试将失败,如下所示:

mcm> reset wait_timeout:mysqld mycluster2;
ERROR 6010 (00MGR): No matching user defined setting was
found for config attribute wait_timeout

如果您希望将此属性重置为其默认值,则必须使用reset具有实例级过滤器规范的命令 wait_timeout:mysqld:4,如下所示:

mcm> reset wait_timeout:mysqld:4 mycluster;
+-----------------------------------+
| Command result                    |
+-----------------------------------+
| Cluster reconfigured successfully |
+-----------------------------------+
1 row in set (7.61 sec)

重置wait_timeout后,它不再出现在先前 get命令的输出中:

mcm> get wait_timeout:mysqld mycluster;
Empty set (1.42 sec)

这是因为该 get命令的默认行为是仅显示那些由 MySQL 集群管理器或用户设置的值。由于wait_timeout已被允许恢复为默认值,您必须使用 --include-defaults(short form: -d) 选项来检索它,如下所示:

mcm> get -d wait_timeout:mysqld mycluster;
+--------------+-------+----------+-----+----------+-----+---------+---------+
| Name         | Value | Process1 | Id1 | Process2 | Id2 | Level   | Comment |
+--------------+-------+----------+-----+----------+-----+---------+---------+
| wait_timeout | 28800 | mysqld   | 4   |          |     | Default |         |
+--------------+-------+----------+-----+----------+-----+---------+---------+
1 row in set (1.66 sec)

现在考虑对配置属性进行进程级和实例级设置的情况;在这个例子中,我们使用 IndexMemory. 首先,验证 是否IndexMemory 为所有数据节点进程设置为默认值(在本例中,有两个):

mcm> get -d IndexMemory mycluster;
+-------------+----------+----------+-----+----------+-----+---------+---------+
| Name        | Value    | Process1 | Id1 | Process2 | Id2 | Level   | Comment |
+-------------+----------+----------+-----+----------+-----+---------+---------+
| IndexMemory | 18874368 | ndbd     | 2   |          |     | Default |         |
| IndexMemory | 18874368 | ndbd     | 3   |          |     | Default |         |
+-------------+----------+----------+-----+----------+-----+---------+---------+
2 rows in set (1.24 sec)

现在将进程级别的更改和实例级别的更改应用到该属性。您可以使用单个 set命令执行此操作,如下所示:

mcm> set IndexMemory:ndbd=500M,IndexMemory:ndbd:3=750M mycluster;
+-----------------------------------+
| Command result                    |
+-----------------------------------+
| Cluster reconfigured successfully |
+-----------------------------------+
1 row in set (7.29 sec)

因为首先指定了进程级更改,所以ndbd进程被第二个指定的实例级更改覆盖。以下get命令的输出确认是这种情况:

mcm> get IndexMemory mycluster;
+-------------+-------+----------+-----+----------+-----+---------+---------+
| Name        | Value | Process1 | Id1 | Process2 | Id2 | Level   | Comment |
+-------------+-------+----------+-----+----------+-----+---------+---------+
| IndexMemory | 500M  | ndbd     | 2   |          |     | Process |         |
| IndexMemory | 750M  | ndbd     | 3   |          |     |         |         |
+-------------+-------+----------+-----+----------+-----+---------+---------+
2 rows in set (0.85 sec)

如果具有进程 ID 的ndbd进程 的实例级 IndexMemory 设置 3被重置,进程级设置仍然适用,如下所示:

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

mcm> get IndexMemory mycluster;
+-------------+-------+----------+-----+----------+-----+---------+---------+
| Name        | Value | Process1 | Id1 | Process2 | Id2 | Level   | Comment |
+-------------+-------+----------+-----+----------+-----+---------+---------+
| IndexMemory | 500M  | ndbd     | 2   |          |     | Process |         |
| IndexMemory | 500M  | ndbd     | 3   |          |     | Process |         |
+-------------+-------+----------+-----+----------+-----+---------+---------+
2 rows in set (1.09 sec)

现在,重新应用实例级 IndexMemory设置,并使用 get 验证它是否已生效:

mcm> set IndexMemory:ndbd:3=750M mycluster;
+-----------------------------------+
| Command result                    |
+-----------------------------------+
| Cluster reconfigured successfully |
+-----------------------------------+
1 row in set (6.79 sec)

mcm> get IndexMemory mycluster;
+-------------+-------+----------+-----+----------+-----+---------+---------+
| Name        | Value | Process1 | Id1 | Process2 | Id2 | Level   | Comment |
+-------------+-------+----------+-----+----------+-----+---------+---------+
| IndexMemory | 500M  | ndbd     | 2   |          |     | Process |         |
| IndexMemory | 750M  | ndbd     | 3   |          |     |         |         |
+-------------+-------+----------+-----+----------+-----+---------+---------+
2 rows in set (1.76 sec)

如果重置进程级设置,实例级设置将保留,并且只有具有进程 ID的ndbd2进程将其 IndexMemory重置为默认值;实例级设置仍然有效,您可以从以下命令序列中看到:

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

mcm> get -d IndexMemory mycluster;
+-------------+----------+----------+-----+----------+-----+---------+---------+
| Name        | Value    | Process1 | Id1 | Process2 | Id2 | Level   | Comment |
+-------------+----------+----------+-----+----------+-----+---------+---------+
| IndexMemory | 18874368 | ndbd     | 2   |          |     | Default |         |
| IndexMemory | 750M     | ndbd     | 3   |          |     |         |         |
+-------------+----------+----------+-----+----------+-----+---------+---------+
2 rows in set (0.10 sec)
笔记

如果设置的原始命令中说明符的顺序IndexMemory被反转为 IndexMemory:ndbd:3=750M,IndexMemory:ndbd=500M,则实例级更改将被进程级更改覆盖,并且 两个ndbd进程 的结果IndexMemory设置将为。正如其他地方所讨论的,在影响同一进程的实例级设置之后进行的进程级设置会完全删除实例级设置;实例级别的设置不会被保留,在进程级别重置属性只会恢复该类型所有进程的默认设置。看500M第 4.5 节,“MySQL 集群管理器配置命令”,了解更多信息。

从MySQL Cluster Manager 1.3.4开始,getreset命令全面支持多入口复制属性;例如,如果 replicate_ignore_table属性有多个条目:

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)

在不指定节点 ID 的情况下,与指定进程类型关联的所有属性条目都将使用以下命令重置:

mcm> reset replicate_ignore_table:mysqld mycluster;  # removes all process level entries
+-----------------------------------+
| Command result                    |
+-----------------------------------+
| Cluster reconfigured successfully |
+-----------------------------------+
1 row in set (0.47 sec)

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.t51 | mysqld   | 51      |          |         |       | Multi-entry |
+------------------------+----------+----------+---------+----------+---------+-------+-------------+
3 rows in set (0.08 sec)

指定节点 ID 后,只有与节点 ID 关联的实例条目会被以下命令重置:

mcm> reset replicate_ignore_table:mysqld:51 mycluster;  # removes all instance level entries for nodeid 51
+-----------------------------------+
| Command result                    |
+-----------------------------------+
| Cluster reconfigured successfully |
+-----------------------------------+
1 row in set (0.57 sec)

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 |
+------------------------+----------+----------+---------+----------+---------+-------+-------------+
2 rows in set (0.09 sec)

重置 TCP 连接属性。  某些配置属性(例如与 TCP 连接相关的配置属性)适用于进程之间的连接,而不适用于单个进程或单个进程类型。如其他地方所示(请参阅设置 TCP 连接属性),当您使用 MySQL Cluster Manager 在进程级别设置此类属性时,这意味着该属性适用于发出set命令时指定的两种类型进程之间的所有连接。也可以在实例级别设置这样的属性,在这种情况下,它仅适用于两个流程实例之间的单个连接。

类似地,可以在流程或实例级别重置此类属性,具体取决于设置它的级别。在任何一种情况下,都需要进程说明符的扩展形式,就像在设置适用于进程间连接的属性时一样。假设SendBufferMemory 先前已为在名为 的 MySQL 集群中找到的两个ndbd进程和两个 mysqld进程之间的所有连接设置了该属性,如以下命令 mycluster2的输出所示:get

mcm> get SendBufferMemory mycluster2;
+------------------+-------+----------+-----+----------+-----+---------+---------+
| Name             | Value | Process1 | Id1 | Process2 | Id2 | Level   | Comment |
+------------------+-------+----------+-----+----------+-----+---------+---------+
| SendBufferMemory | 4M    | ndbd     | 2   | mysqld   | 4   | Process |         |
| SendBufferMemory | 4M    | ndbd     | 2   | mysqld   | 5   | Process |         |
| SendBufferMemory | 4M    | ndbd     | 3   | mysqld   | 4   | Process |         |
| SendBufferMemory | 8M    | ndbd     | 3   | mysqld   | 5   |         |         |
+------------------+-------+----------+-----+----------+-----+---------+---------+
4 rows in set (0.59 sec)

假设您只想重置 具有进程 ID 的ndbd进程和具有进程 ID的 mysqld进程 SendBufferMemory之间的连接。适用于此连接的 设置是在实例级别指定的,如您所见,因为 与此连接对应的列值为空;这意味着可以在实例级别重置此值。您可以使用 此处显示的命令执行此操作: 35SendBufferMemoryLevelreset

mcm> reset SendBufferMemory:ndbd:3+mysqld:5 mycluster2;
+-----------------------------------+
| Command result                    |
+-----------------------------------+
| Cluster reconfigured successfully |
+-----------------------------------+
1 row in set (7.03 sec)

您可以使用命令验证属性是否已重置 get。然而,如前所述,一旦删除了实例级设置,此属性的进程级设置将再次生效,因此相同的设置适用于 ndbdmysqld进程之间的所有连接,如下所示:

mcm> get SendBufferMemory mycluster2;
+------------------+-------+----------+-----+----------+-----+---------+---------+
| Name             | Value | Process1 | Id1 | Process2 | Id2 | Level   | Comment |
+------------------+-------+----------+-----+----------+-----+---------+---------+
| SendBufferMemory | 4M    | ndbd     | 2   | mysqld   | 4   | Process |         |
| SendBufferMemory | 4M    | ndbd     | 2   | mysqld   | 5   | Process |         |
| SendBufferMemory | 4M    | ndbd     | 3   | mysqld   | 4   | Process |         |
| SendBufferMemory | 4M    | ndbd     | 3   | mysqld   | 5   | Process |         |
+------------------+-------+----------+-----+----------+-----+---------+---------+
4 rows in set (0.87 sec)

要在进程级别重置此属性,可以使用以下reset命令:

mcm> reset SendBufferMemory:ndbd+mysqld mycluster2;
+-----------------------------------+
| Command result                    |
+-----------------------------------+
| Cluster reconfigured successfully |
+-----------------------------------+
1 row in set (8.01 sec)

您可以使用命令验证是否已为ndbd进程和 mysqld进程 之间的所有连接重置该属性get,如下所示:

mcm> get -d SendBufferMemory mycluster2;
Empty set (1.39 sec)

如本手册其他地方所述(请参阅 第 4.5.1 节,“get命令”),在这种情况下预期会出现空结果集,即使 使用(或)选项get调用时也是 如此,因为 MySQL Cluster Manager 客户端不如果用户未明确设置,则 显示出现在配置文件的或 部分中的 属性。--include-defaults-d[tcp][shm]config.ini