第 5 章 配置 Pacemaker 集群
5.1. 部署基本集群配置 复制链接链接已复制到粘贴板!
以下基本集群设置涵盖了开始在双节点集群中管理 SAP 实例的 Pacemaker 集群设置的最小步骤。
有关复杂配置设置和选项的更多信息,请参阅 RHEL HA 附加组件文档,例如 配置和管理高可用性集群。
先决条件
- 已安装并配置了您要在集群中管理的所有 SAP 实例。
-
您已在计划的集群节点上配置了
RHEL高可用性存储库。 - 您已根据您计划的环境验证了隔离和仲裁要求。如需了解更多详细信息,请参阅 HA 集群要求。
流程
从 High Availability 存储库安装红帽高可用性附加组件软件包。选择您要在所有集群节点上安装并执行安装的隔离代理。
安装集群软件包和所有隔离代理:
[root]# dnf install pcs pacemaker fence-agents-all或者根据您的环境安装集群软件包和一个特定的隔离代理:
[root]# dnf install pcs pacemaker fence-agents-<model>
在所有集群节点上启动并启用
pcsd服务:[root]# systemctl enable --now pcsd.service可选:如果您正在运行
firewalld服务,请启用红帽高可用性附加组件所需的端口。在所有集群节点上运行它:[root]# firewall-cmd --add-service=high-availability [root]# firewall-cmd --runtime-to-permanent为用户
hacluster设置密码。在每个节点上使用相同的密码重复该命令:[root]# passwd hacluster为集群中的每个节点验证用户
hacluster。在第一个节点上运行:[root]# pcs host auth <node1> <node2> Username: hacluster Password: <node1>: Authorized <node2>: Authorized-
输入带有或不使用 FQDN 的节点名称,如
/etc/hosts文件中定义的。 -
在提示符后输入
hacluster用户密码。
-
输入带有或不使用 FQDN 的节点名称,如
使用名称创建集群,并提供群集成员的名称,如
node1和node2,带有完全限定的主机名。这会在两个节点上传播集群配置并启动集群。在第一个节点上运行这个命令:[root]# pcs cluster setup <cluster_name> --start <node1> <node2> No addresses specified for host 'node1', using 'node1' No addresses specified for host 'node2', using 'node2' Destroying cluster on hosts: 'node1', 'node2'... node2: Successfully destroyed cluster node1: Successfully destroyed cluster Requesting remove 'pcsd settings' from 'node1', 'node2' node1: successful removal of the file 'pcsd settings' node2: successful removal of the file 'pcsd settings' Sending 'corosync authkey', 'pacemaker authkey' to 'node1', 'node2' node1: successful distribution of the file 'corosync authkey' node1: successful distribution of the file 'pacemaker authkey' node2: successful distribution of the file 'corosync authkey' node2: successful distribution of the file 'pacemaker authkey' Sending 'corosync.conf' to 'node1', 'node2' node1: successful distribution of the file 'corosync.conf' node2: successful distribution of the file 'corosync.conf' Cluster has been successfully set up. Starting cluster on hosts: 'node1', 'node2'...在系统引导时自动启动集群,这样可启用
corosync和pacemaker服务。如果您希望在节点重启后手动控制集群的启动,请跳过这一步。在一个节点上运行:[root]# pcs cluster enable --all node1: Cluster Enabled node2: Cluster Enabled
验证
检查集群状态。验证集群守护进程服务是否处于所需的状态:
[root]# pcs status --full Cluster name: node1-node2-cluster WARNINGS: No stonith devices and stonith-enabled is not false Cluster Status: Cluster Summary: * Stack: corosync (Pacemaker is running) * Current DC: node1 (version ) - partition with quorum * Last updated: * on node1 * Last change: ** by hacluster via hacluster on node1 * 2 nodes configured * 0 resource instances configured ... PCSD Status: node1: Online node2: Online Daemon Status: corosync: active/enabled pacemaker: active/enabled pcsd: active/enabled
后续步骤
- 配置隔离方法以启用 STONITH 机制。请参阅 在红帽高可用性集群中配置隔离。
- 在进行进一步配置前,测试隔离设置。如需更多信息,请参阅如何在红帽高可用性集群中测试隔离设备和隔离配置?