第 5 章 配置 Pacemaker 集群


5.1. 部署基本集群配置

以下基本集群设置涵盖了管理 SAP HANA 系统复制的 Pacemaker 集群设置的最小步骤。

有关复杂配置设置和选项的更多信息,请参阅 RHEL HA 附加组件文档,例如,创建一个具有多个链接的高可用性集群

先决条件

  • 您已设置了 HANA 系统复制环境,并验证它是否正常工作。
  • 您已在要成为此集群节点的所有系统上配置了 RHEL 高可用性存储库。
  • 您已根据您计划的环境验证了隔离和仲裁要求。如需了解更多详细信息,请参阅 HA 集群要求

流程

  1. 从 High Availability 存储库安装红帽高可用性附加组件软件包。选择您要在所有集群节点上安装并执行安装的隔离代理。

    1. 安装集群软件包和所有隔离代理:

      [root]# dnf install pcs pacemaker fence-agents-all
      Copy to Clipboard Toggle word wrap
    2. 或者根据您的环境安装集群软件包和一个特定的隔离代理:

      [root]# dnf install pcs pacemaker fence-agents-<model>
      Copy to Clipboard Toggle word wrap
  2. 在所有集群节点上启动并启用 pcsd 服务:

    [root]# systemctl enable --now pcsd.service
    Copy to Clipboard Toggle word wrap
  3. 可选:如果您正在运行 firewalld 服务,请启用红帽高可用性附加组件所需的端口。在所有集群节点上运行它:

    [root]# firewall-cmd --add-service=high-availability
    [root]# firewall-cmd --runtime-to-permanent
    Copy to Clipboard Toggle word wrap
  4. 为用户 hacluster 设置密码。在每个节点上使用相同的密码重复该命令:

    [root]# passwd hacluster
    Copy to Clipboard Toggle word wrap
  5. 为集群中的每个节点验证用户 hacluster。在第一个节点上运行:

    [root]# pcs host auth <node1> <node2>
    Username: hacluster
    Password:
    <node1>: Authorized
    <node2>: Authorized
    Copy to Clipboard Toggle word wrap
    • 输入带有或不使用 FQDN 的节点名称,如 /etc/hosts 文件中定义的。
    • 在提示符后输入 hacluster 用户密码。
  6. 使用名称创建集群,并提供群集成员的名称,如 node1node2,带有完全限定的主机名。这会在两个节点上传播集群配置并启动集群。在第一个节点上运行这个命令:

    [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'...
    Copy to Clipboard Toggle word wrap
  7. 在系统引导时自动启动集群,这样可启用 corosyncpacemaker 服务。如果您希望在节点重启后手动控制集群的启动,请跳过这一步。在一个节点上运行:

    [root]# pcs cluster enable --all
    node1: Cluster Enabled
    node2: Cluster Enabled
    Copy to Clipboard Toggle word wrap

验证

  • 检查集群状态。验证集群守护进程服务是否处于所需的状态:

    [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
    Copy to Clipboard Toggle word wrap

后续步骤

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat