集群节点设置 - SAP HANA on AWS

集群节点设置

使用 Corosync 并配置所需的身份验证,在节点之间建立集群通信。

部署仲裁生成器节点(仅限横向扩展集群)

注意

只有拥有两个以上节点的集群才需要此选项。

在 AWS 云端部署 SAP HANA 横向扩展集群时,您必须在第三个可用区(AZ)中包含一个仲裁生成器节点。仲裁生成器(平局决胜机制)节点在一个可用区出现故障时,通过保留仲裁权来确保集群保持正常运行。要使横向扩展集群正常运行,必须至少有一个可用区中的所有节点以及仲裁生成器节点在运行。如果不满足此最低要求,则集群将失去其仲裁状态,所有剩余的 SAP HANA 节点都将被隔离。

仲裁生成器要求的最低 EC2 实例配置为 2 个 vCPU、2 GB RAM 和 50 GB 磁盘空间;此实例专门用于仲裁管理,不托管 SAP HANA 数据库或任何其他集群资源。

更改 hacluster 密码

在所有集群节点上,更改操作系统用户 hacluster 的密码:

# passwd hacluster

设置无密码身份验证

SUSE 提供了多种报告工具,可以用来获取更全面、更易于使用的集群活动视图。其中许多工具都需要不输入密码来访问两个节点的权限。SUSE 建议由根用户执行此设置。

有关更多详细信息,请参阅 SUSE 文档 Usage of hb_report for SLES HAE 中的“Configuration to collect cluster report as root with root SSH access between cluster nodes”部分。

警告

在实施此配置之前,请查看配置对组织的安全影响,包括根访问权限控制和网络分段。

配置集群节点

在第一个节点上初始化集群框架,包括所有已知的集群节点。

在主节点上以根用户身份运行以下命令:

# crm cluster init -u -n <cluster_name> -N <hostname_1> -N <hostname_2>

使用参数参考中的值的示例

hanahost01:~ # crm cluster init -u -n myCluster -N hanahost01 -N hanahost02 INFO: Detected "amazon-web-services" platform INFO: Loading "default" profile from /etc/crm/profiles.yml INFO: Configure Corosync (unicast): This will configure the cluster messaging layer. You will need to specify a network address over which to communicate (default is eth0's network, but you can use the network address of any active interface). Address for ring0 [10.2.10.1] Port for ring0 [5405] Do you wish to use SBD (y/n)? n WARNING: Not configuring SBD - STONITH will be disabled. Do you wish to configure a virtual IP address (y/n)? n Do you want to configure QDevice (y/n)? n INFO: Done (log saved to /var/log/crmsh/crmsh.log) INFO: Adding node hanahost02 to cluster INFO: Running command on hanahost02: crm cluster join -y -c root@hanahost01 ... INFO: Done (log saved to /var/log/crmsh/crmsh.log)

此命令:

  • 初始化名为 myCluster 的双节点集群

  • 配置单播通信(-u)

  • 设置基本 corosync 配置

  • 自动将第二个节点加入集群

  • 我们不会像在 AWS 环境中对 STONITH 那样,将 SBD 配置为 fence_aws

  • 可以进行 QDevice 配置,不过本文档中未介绍。请参阅 SUSE Linux Enterprise High Availability 文档 - QDevice 和 QNetD

  • 对于具有两个以上节点的集群,可以在初始化期间使用额外的 -N <hostname_3> 参数添加其他节点,也可以稍后在每个新节点上使用以下命令添加:

    # crm cluster join -c <hostname_1>

修改创建的 Corosync 配置

初始化集群后,需要对生成的 corosync 配置进行一些修改,以便针对云环境进行优化。

1. 编辑 corosync 配置:

# vi /etc/corosync/corosync.conf

生成的文件通常如以下所示:

# Please read the corosync.conf.5 manual page totem { version: 2 cluster_name: myCluster clear_node_high_bit: yes interface { ringnumber: 0 mcastport: 5405 ttl: 1 } transport: udpu crypto_hash: sha1 crypto_cipher: aes256 token: 5000 # This needs to be changed join: 60 max_messages: 20 token_retransmits_before_loss_const: 10 } logging { fileline: off to_stderr: no to_logfile: yes logfile: /var/log/cluster/corosync.log to_syslog: yes debug: off timestamp: on logger_subsys { subsys: QUORUM debug: off } } nodelist { node { ring0_addr: <node1_primary_ip> # Only single ring configured nodeid: 1 } node { ring0_addr: <node2_primary_ip> # Only single ring configured nodeid: 2 } } quorum { # Enable and configure quorum subsystem (default: off) # see also corosync.conf.5 and votequorum.5 provider: corosync_votequorum expected_votes: 2 two_node: 1 } totem { version: 2 token: 5000 # This needs to be changed transport: udpu interface { ringnumber: 0 mcastport: 5405 } }

2. 修改配置以添加第二个环路并优化设置:

totem { token: 15000 # Changed from 5000 to 15000 rrp_mode: passive # Added for dual ring support } nodelist { node { ring0_addr: <node1_primary_ip> # Primary network ring1_addr: <node1_secondary_ip> # Added secondary network nodeid: 1 } node { ring0_addr: <node2_primary_ip> # Primary network ring1_addr: <node2_secondary_ip> # Added secondary network nodeid: 2 } }

示例 IP 配置:

网络接口 节点 1 节点 2

ring0_addr

10.2.10.1

10.2.20.1

ring1_addr

10.2.10.2

10.2.20.2

3. 将修改后的配置同步到所有节点:

# csync2 -f /etc/corosync/corosync.conf

4. 重启集群

# crm cluster restart --all

验证 Corosync 配置

验证网络环路是否活动:

# corosync-cfgtool -s

输出示例

Printing ring status. Local node ID 1 RING ID 0 id = 10.2.10.1 status = ring 0 active with no faults RING ID 1 id = 10.2.10.2 status = ring 1 active with no faults

两个网络环路都应报告“活动且没有故障”。如果缺少任何一个环路,请查看 corosync 配置并检查 /etc/corosync/corosync.conf 更改是否已同步到辅助节点。您可能需要手动执行此操作。如有必要,请重启集群。

配置集群服务

启用 Pacemaker,使其在重启后自动启动:

# systemctl enable pacemaker

启用 Pacemaker 还可以通过服务依赖关系来处理 corosync。集群将在重启后自动启动。对于故障排除场景,您可以改为选择在启动后手动启动服务。

验证集群状态

1. 检查 Pacemaker 服务状态:

# systemctl status pacemaker

2. 验证集群状态:

# crm_mon -1

输出示例

Cluster Summary: * Stack: corosync * Current DC: hanahost01 (version 2.1.5+20221208.a3f44794f) - partition with quorum * 2 nodes configured * 0 resource instances configured Node List: * Online: [ hanahost01 hanahost02 ] Active Resources: * No active resources