Skip to main content
我们经常发布文档更新,此页面的翻译可能仍在进行中。 有关最新信息,请访问英语文档

替换集群节点

要替换 GitHub Enterprise Server 节点,必须在群集配置文件 (cluster.conf) 中将受影响的节点标记为离线,然后添加替换节点。 如果节点发生故障,或者添加具有更多资源的节点以提高性能,则可能需要执行此操作。

关于替换群集节点

GitHub Enterprise Server 的群集拓扑为拥有数万名开发人员的公司提供水平缩放。 如果单个主节点经常遇到资源耗尽,GitHub 建议执行聚类分析。 聚类分析需要仔细规划和额外的管理开销。 有关详细信息,请参阅“关于集群”。

可以替换群集中的功能节点,也可以替换意外失败的节点。

警告:要避免冲突,替换节点必须使用先前未在群集中使用的新主机名。

替换功能节点

  1. 在替换节点上使用唯一主机名预配和安装 GitHub Enterprise Server。 1. 使用管理 shell 或 DHCP,仅配置替换节点的 IP 地址。 不要配置任何其他设置。 1. 若要添加新预配的替换节点,可在任何节点上修改 cluster.conf 文件以删除失败的节点并添加替换节点。 例如,修改后的 cluster.conf 文件会将 ghe-data-node-3 替换为新预配的节点 ghe-replacement-data-node-3

    [cluster "ghe-replacement-data-node-3"]
      hostname = ghe-replacement-data-node-3
      ipv4 = 192.168.0.7
      # ipv6 = fd12:3456:789a:1::7
      git-server = true
      pages-server = true
      mysql-server = true
      elasticsearch-server = true
      redis-server = true
      memcache-server = true
      metrics-server = true
      storage-server = true
    
    1. 从含有经修改 `cluster.conf` 的节点的管理 shell 中,运行 `ghe-cluster-config-init`。 这将初始化集群中新增的节点。 1. 从同一节点中运行 `ghe-cluster-config-apply`。 这将验证配置文件、将其复制到集群中的每个节点以及根据修改的 `cluster.conf` 文件配置每个节点。 1. 如果要使提供数据服务(例如 `git-server`、`pages-server` 或 `storage-server`)的节点脱机,请疏散该节点。 有关详细信息,请参阅“[AUTOTITLE](/admin/enterprise-management/configuring-clustering/evacuating-a-cluster-node-running-data-services)”。 1. 若要将失败的节点标记为脱机,请在任何节点上修改相关节点部分中的[群集配置文件](/admin/enterprise-management/configuring-clustering/initializing-the-cluster#about-the-cluster-configuration-file) (`cluster.conf`),使其包含文本 `offline = true`。

    例如,此修改的 cluster.confghe-data-node-3 节点标记为脱机:

      [cluster "ghe-data-node-3"]
      hostname = ghe-data-node-3
      offline = true
      ipv4 = 192.168.0.6
      # ipv6 = fd12:3456:789a:1::6
      
    1. 从修改 `cluster.conf` 的节点的管理 shell 中,运行 `ghe-cluster-config-apply`。 这将验证配置文件、将其复制到集群中的每个节点以及将该节点标记为离线。 1. 如果要替换主 MySQL 或 Redis 节点,请在 `cluster.conf` 中,使用替换节点名称修改 `mysql-master` 或 `redis-master` 值。

    例如,此修改的 cluster.conf 文件将新预配的群集节点 ghe-replacement-data-node-1 指定为主 MySQL 和 Redis 节点:

    mysql-master = ghe-replacement-data-node-1
    redis-master = ghe-replacement-data-node-1
    

在紧急情况下替换节点

  1. 在替换节点上使用唯一主机名预配和安装 GitHub Enterprise Server。 1. 使用管理 shell 或 DHCP,仅配置替换节点的 IP 地址。 不要配置任何其他设置。 1. 若要将失败的节点标记为脱机,请在任何节点上修改相关节点部分中的群集配置文件 (cluster.conf),使其包含文本 offline = true

    例如,此修改的 cluster.confghe-data-node-3 节点标记为脱机:

      [cluster "ghe-data-node-3"]
      hostname = ghe-data-node-3
      offline = true
      ipv4 = 192.168.0.6
      # ipv6 = fd12:3456:789a:1::6
      
    1. 从修改 `cluster.conf` 的节点的管理 shell 中,运行 `ghe-cluster-config-apply`。 这将验证配置文件、将其复制到集群中的每个节点以及将该节点标记为离线。 1. 若要添加新预配的替换节点,可在任何节点上修改 `cluster.conf` 文件以删除失败的节点并添加替换节点。 例如,修改后的 `cluster.conf` 文件会将 `ghe-data-node-3` 替换为新预配的节点 `ghe-replacement-data-node-3`:
    [cluster "ghe-replacement-data-node-3"]
      hostname = ghe-replacement-data-node-3
      ipv4 = 192.168.0.7
      # ipv6 = fd12:3456:789a:1::7
      git-server = true
      pages-server = true
      mysql-server = true
      elasticsearch-server = true
      redis-server = true
      memcache-server = true
      metrics-server = true
      storage-server = true
    
    1. 如果要替换主 MySQL 或 Redis 节点,请在 `cluster.conf` 中,使用替换节点名称修改 `mysql-master` 或 `redis-master` 值。

    例如,此修改的 cluster.conf 文件将新预配的群集节点 ghe-replacement-data-node-1 指定为主 MySQL 和 Redis 节点:

    mysql-master = ghe-replacement-data-node-1
    redis-master = ghe-replacement-data-node-1
    
    1. 从含有经修改 `cluster.conf` 的节点的管理 shell 中,运行 `ghe-cluster-config-init`。 这将初始化集群中新增的节点。 1. 从同一节点中运行 `ghe-cluster-config-apply`。 这将验证配置文件、将其复制到集群中的每个节点以及根据修改的 `cluster.conf` 文件配置每个节点。 1. 如果要使提供数据服务(例如 `git-server`、`pages-server` 或 `storage-server`)的节点脱机,请疏散该节点。 有关详细信息,请参阅“[AUTOTITLE](/admin/enterprise-management/configuring-clustering/evacuating-a-cluster-node-running-data-services)”。