文档首页
MySQL 8.4 参考手册
8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

25.6.6 NDB 集群单用户模式25.6.6 NDB Cluster Single User Mode

单用户模式 允许数据库管理员将对数据库系统的访问限制为单个 API 节点,例如 MySQL 服务器(SQL 节点)或一个 ndb_restore 实例。进入单用户模式时,所有其他 API 节点的连接都会被正常关闭,所有正在运行的事务都会被中止。新事务将不允许启动。Single user mode enables the database administrator to restrict access to the database system to a single API node, such as a MySQL server (SQL node) or an instance of ndb_restore. When entering single user mode, connections to all other API nodes are closed gracefully and all running transactions are aborted. No new transactions are permitted to start.

一旦集群进入单用户模式,只有指定的 API 节点被授予访问数据库的权限。Once the cluster has entered single user mode, only the designated API node is granted access to the database.

您可以在 ndb_mgm 客户端中使用 ALL STATUS 命令来查看集群何时进入单用户模式。您也可以检查 ndbinfo.nodes 表的 status 列(有关详细信息,请参见 第 25.6.15.48 节,“ndbinfo nodes 表”)。You can use the ALL STATUS command in the ndb_mgm client to see when the cluster has entered single user mode. You can also check the status column of the ndbinfo.nodes table (see Section 25.6.15.48, “The ndbinfo nodes Table”, for more information).

示例:Example:

ndb_mgm> ENTER SINGLE USER MODE 5

在此命令执行后且集群进入单用户模式时,节点 ID 为 5 的 API 节点将成为集群唯一允许的用户。After this command has executed and the cluster has entered single user mode, the API node whose node ID is 5 becomes the cluster's only permitted user.

前一个命令中指定的节点必须是 API 节点;尝试指定任何其他类型的节点都会被拒绝。The node specified in the preceding command must be an API node; attempting to specify any other type of node is rejected.

Note

当调用前一个命令时,所有在指定节点上运行的事务都会被中止,连接会被关闭,并且服务器必须重新启动。When the preceding command is invoked, all transactions running on the designated node are aborted, the connection is closed, and the server must be restarted.

命令 EXIT SINGLE USER MODE 会将集群的数据节点状态从单用户模式更改为正常模式。等待连接的 API 节点(例如 MySQL 服务器,即等待集群准备就绪并可用)再次被允许连接。被指定为单用户节点的 API 节点在状态更改期间及之后仍会继续运行(如果仍然连接)。The command EXIT SINGLE USER MODE changes the state of the cluster's data nodes from single user mode to normal mode. API nodes—such as MySQL Servers—waiting for a connection (that is, waiting for the cluster to become ready and available), are again permitted to connect. The API node denoted as the single-user node continues to run (if still connected) during and after the state change.

示例:Example:

ndb_mgm> EXIT SINGLE USER MODE

在单用户模式下运行时,处理节点故障有两种推荐方法:There are two recommended ways to handle a node failure when running in single user mode:

  • 方法 1:Method 1:

    1. 完成所有单用户模式事务Finish all single user mode transactions

    2. 执行 EXIT SINGLE USER MODE 命令Issue the EXIT SINGLE USER MODE command

    3. 重启集群的数据节点Restart the cluster's data nodes

  • 方法 2:Method 2:

    在进入单用户模式之前重启存储节点。Restart storage nodes prior to entering single user mode.