替换集群节点
要替换 GitHub Enterprise Server 节点,必须在集群配置文件 (cluster.conf) 中将受影响的节点标记为离线,然后添加替换节点。 如果节点发生故障,或者添加具有更多资源的节点以提高性能,则可能需要执行此操作。
警告:替换节点必须使用先前未在集群中使用的主机名以避免冲突。
本文内容:
在紧急情况下替换节点
-
Provision and install GitHub Enterprise Server with a unique hostname on the replacement node.
-
Using the administrative shell or DHCP, only configure the IP address of the replacement node. 不要配置任何其他设置。
-
要将失败的节点标记为离线,在任何节点上修改相关代码部分的群集配置文件 (
cluster.conf
),以包含文本offline = true
。例如,下面修改的
cluster.conf
会将ghe-data-node-3
节点标记为离线:[cluster "ghe-data-node-3"] hostname = ghe-data-node-3offline = trueipv4 = 192.168.0.6 # ipv6 = fd12:3456:789a:1::6
-
From the administrative shell of the node where you modified
cluster.conf
, runghe-cluster-config-apply
. This will validate the configuration file, copy it to each node in the cluster, and mark the node offline. -
要添加新配置的更换节点,在任何节点上,修改
cluster.conf
文件以删除失败的节点并添加更换节点。 例如,下面修改的cluster.conf
文件会将ghe-data-node-3
替换为新配置的节点ghe-replacement-data-node-3
:[cluster "ghe-replacement-data-node-3"] hostname = ghe-replacement-data-node-3ipv4 = 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
-
If you're replacing the MySQL master node or Redis master node, in
cluster.conf
, modify themysql-master
orredis-master
value with the replacement node name.For example, this modified
cluster.conf
file specifies a newly provisioned cluster node,ghe-replacement-data-node-1
as the MySQL and Redis master node:mysql-master = ghe-replacement-data-node-1redis-master = ghe-replacement-data-node-1
-
From the administrative shell of the node with the modified
cluster.conf
, runghe-cluster-config-init
. This will initialize the newly added node in the cluster. -
From the same node, run
ghe-cluster-config-apply
. This will validate the configuration file, copy it to each node in the cluster, and configure each node according to the modifiedcluster.conf
file.