8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

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

打开官方英文原文 ↗

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

MySQL 8.4 参考手册 / 25 MySQL NDB 集群 8.4 / 25.3 NDB 集群安装 / 25.3.6 NDB Cluster 的安全关闭和重启
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

25.3.6 安全关闭和重启 NDB 集群25.3.6 Safe Shutdown and Restart of NDB Cluster

要关闭集群,请在管理节点所在机器的终端中输入以下命令:To shut down the cluster, enter the following command in a shell on the machine hosting the management node:

$> ndb_mgm -e shutdown

这里的 -e 选项用于从 shell 向 ndb_mgm 客户端传递命令。该命令会导致 ndb_mgm、ndb_mgmd 以及任何 ndbd 或 ndbmtd 进程优雅地终止。任何 SQL 节点都可以使用 mysqladmin shutdown 或其他方法终止。在 Windows 平台上,假设您已将 SQL 节点安装为 Windows 服务,则可以使用 SC STOP service_name 或 NET STOP service_name。The -e option here is used to pass a command to the ndb_mgm client from the shell. The command causes the ndb_mgm, ndb_mgmd, and any ndbd or ndbmtd processes to terminate gracefully. Any SQL nodes can be terminated using mysqladmin shutdown and other means. On Windows platforms, assuming that you have installed the SQL node as a Windows service, you can use SC STOP service_name or NET STOP service_name.

要在 Unix 平台上重启集群,请运行以下命令:To restart the cluster on Unix platforms, run these commands:

  • 在管理主机上(在我们的示例设置中为 198.51.100.10):On the management host (198.51.100.10 in our example setup):

    $> ndb_mgmd -f /var/lib/mysql-cluster/config.ini
    
  • 在每个数据节点主机上(198.51.100.30 和 198.51.100.40):On each of the data node hosts (198.51.100.30 and 198.51.100.40):

    $> ndbd
    
  • 使用 ndb_mgm 客户端验证两个数据节点是否已成功启动。Use the ndb_mgm client to verify that both data nodes have started successfully.

  • 在 SQL 主机上(198.51.100.20):On the SQL host (198.51.100.20):

    $> mysqld_safe &
    

在 Windows 平台上,假设你已将所有 NDB Cluster 进程作为 Windows 服务安装,并使用默认的服务名称(参见 第 25.3.2.4 节,“将 NDB Cluster 进程安装为 Windows 服务”),你可以按如下方式重新启动集群:On Windows platforms, assuming that you have installed all NDB Cluster processes as Windows services using the default service names (see Section 25.3.2.4, “Installing NDB Cluster Processes as Windows Services”), you can restart the cluster as follows:

  • 在管理主机(在我们的示例设置中为 198.51.100.10)上,执行以下命令:On the management host (198.51.100.10 in our example setup), execute the following command:

    C:\> SC START ndb_mgmd
    
  • 在每个数据节点主机(198.51.100.30 和 198.51.100.40)上,执行以下命令:On each of the data node hosts (198.51.100.30 and 198.51.100.40), execute the following command:

    C:\> SC START ndbd
    
  • 在管理节点主机上,使用 ndb_mgm 客户端来验证管理节点和两个数据节点是否已成功启动(参见 第 25.3.2.3 节,“Windows 上 NDB 集群的初始启动”)。On the management node host, use the ndb_mgm client to verify that the management node and both data nodes have started successfully (see Section 25.3.2.3, “Initial Startup of NDB Cluster on Windows”).

  • 在 SQL 节点主机(198.51.100.20)上,执行以下命令:On the SQL node host (198.51.100.20), execute the following command:

    C:\> SC START mysql
    

在生产环境中,通常不希望完全关闭集群。在许多情况下,即使是在进行配置更改或升级集群硬件或软件(或两者)时,需要关闭单个主机,也可以通过执行集群的滚动重启而无需完全关闭整个集群。有关执行此操作的更多信息,请参见第 25.6.5 节,“执行 NDB 集群的滚动重启”。In a production setting, it is usually not desirable to shut down the cluster completely. In many cases, even when making configuration changes, or performing upgrades to the cluster hardware or software (or both), which require shutting down individual host machines, it is possible to do so without shutting down the cluster as a whole by performing a rolling restart of the cluster. For more information about doing this, see Section 25.6.5, “Performing a Rolling Restart of an NDB Cluster”.