4.4.3. 添加集群节点
注意
强烈建议您仅在生产环境维护窗口期间将节点添加到现有集群中。这可让您对新节点及其保护配置执行适当的资源和部署测试。
使用以下步骤将新节点添加到现有集群中。在本例中,现有群集节点为
clusternode-01.example.com、cluster
node-02.example.com
和 clusternode-03.example.com
。新节点为 newnode.example.com
。
在加入到集群中的新节点上,执行以下任务。
- 安装集群软件包。如果集群使用 SBD、Booth ticket 管理器或仲裁设备,则必须在新节点上手动安装相应的软件包(
sbd
、booth
)。-site
、corosync-qdeviceyum install -y pcs fence-agents-all
[root@newnode ~]# yum install -y pcs fence-agents-all
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 如果您正在运行 firewalld 守护进程,请执行以下命令启用红帽高可用性附加组件所需的端口。
firewall-cmd --permanent --add-service=high-availability firewall-cmd --add-service=high-availability
# firewall-cmd --permanent --add-service=high-availability # firewall-cmd --add-service=high-availability
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 设置用户 ID
hacluster
的密码。建议您为集群中的每个节点使用相同的密码。Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 执行以下命令启动
pcsd
服务并在系统启动时启用pcsd
:systemctl start pcsd.service systemctl enable pcsd.service
# systemctl start pcsd.service # systemctl enable pcsd.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
在现有集群中的一个节点上执行以下任务。
- 在新群集节点上验证用户
hacluster
。pcs cluster auth newnode.example.com
[root@clusternode-01 ~]# pcs cluster auth newnode.example.com Username: hacluster Password: newnode.example.com: Authorized
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 在现有集群中添加新节点。此命令还会将群集配置文件
corosync.conf
同步到集群中的所有节点,包括您要添加的新节点。pcs cluster node add newnode.example.com
[root@clusternode-01 ~]# pcs cluster node add newnode.example.com
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
在加入到集群中的新节点上,执行以下任务。
- 在新节点上启动并启用集群服务。
pcs cluster start pcs cluster enable
[root@newnode ~]# pcs cluster start Starting Cluster... [root@newnode ~]# pcs cluster enable
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 确保您为新集群节点配置并测试隔离设备。有关配置隔离设备的详情请参考 第 5 章 隔离:配置 STONITH。