集群配置 - SAP HANA 开启 Amazon
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

集群配置

系统日志

SUSE 建议使用 rsyslogd 守护程序登录 SUSE 集群。以 root 用户身份在所有群集节点上安装rsyslog软件包。 logd是一个用于记录来自STONITH代理的其他信息的子系统:

prihana:~ # zypper install rsyslog prihana:~ # systemctl enable logd prihana:~ # systemctl start logd

Corosync 配置

执行群集配置时,群集服务 (Pacemaker) 应处于停止状态。检查状态并停止 Pacemaker 服务(如果该服务正在运行)。

  • 这是检查起搏器状态的命令:

    prihana:~ # systemctl status pacemaker
  • 这是停止 Pacemaker 的命令:

    prihana:~ # systemctl stop pacemaker

创建加密密钥

运行以下命令创建用于加密所有集群通信的密钥:

prihana:~ # corosync-keygen

将在位置创建名为 “authkey” 的新密钥文件/etc/corosync/。将此文件复制到具有相同权限和所有权的第二个群集节点上的相同位置。

为冗余群集环创建辅助 IP 地址

对于 SUSE 集群,我们建议在 corosync 中定义一个冗余通信信道(第二环),集群节点可以使用该通道在发生中断时进行通信。

要创建冗余通信信道,必须在两个节点上添加辅助 IP 地址。这些 IP 仅用于群集配置。它们提供与辅助弹性网络接口 (ENI) 相同的容错能力。有关更多信息,请参阅分配辅助私有 IPv4 地址

查看与集群操作冲突的实例设置

为确保重启是可预测的,我们建议禁用简化的自动恢复,不要为属于 pacemaker 集群的实例配置基于 Amazon CloudWatch 操作的恢复。使用以下命令禁用简化的自动恢复。

aws ec2 modify-instance-maintenance-options --instance-id i-0abcdef1234567890 --auto-recovery disabled

您必须确保对属于起搏器集群的 Amazon EC2 实例禁用停止保护。使用以下命令禁用停止保护。

aws ec2 modify-instance-attribute --instance-id i-1234567890abcdef0 --no-disable-api-stop

创建 Corosync 配置文件

所有群集节点都必须具有本地配置文件 “/etc/corosync/corosync.conf”,如以下示例所示。

prihana:/etc/corosync # cat corosync.conf # Please read the corosync.conf.5 manual page totem { version: 2 token: 30000 consensus: 36000 token_retransmits_before_loss_const: 6 crypto_cipher: none crypto_hash: none clear_node_high_bit: yes rrp_mode: passive interface { ringnumber: 0 bindnetaddr: 11.0.1.132 mcastport: 5405 ttl: 1 } transport: udpu } logging { fileline: off to_logfile: yes to_syslog: yes logfile: /var/log/cluster/corosync.log debug: off timestamp: on logger_subsys { subsys: QUORUM debug: off } } nodelist { node { ring0_addr: 11.0.1.132 ring1_addr: 11.0.1.75 nodeid: 1 } node { ring0_addr: 11.0.2.139 ring1_addr: 11.0.2.35 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 }

将以下变量的值替换为适用于您的环境的值:

  • bindnetaddr— 正在配置文件的节点的 IP 地址。

  • ring0_addr— 群集节点 1 的主要 IP 地址。

  • ring1_addr— 群集节点 1 的辅助 IP 地址。

  • ring0_addr— 群集节点 2 的主要 IP 地址。

  • ring1_addr— 群集节点 2 的辅助 IP 地址。

还要根据您的加密要求更新 f crypto_hash or crypto_cipher 和的值。

更新hacluster密码

更改两个节点haclustser上的用户密码,如以下示例所示:

prihana:~ # passwd hacluster
sechana:~ # passwd hacluster

启动集群

在主节点和辅助节点上启动群集并检查状态。

  • 这是检查起搏器状态的命令:

    prihana:~ # systemctl status pacemaker
  • 这是启动 Pacemaker 的命令:

    prihana:~ # systemctl start pacemaker

启动群集服务 (Pacemaker) 后,使用crm_mon命令检查集群状态,如以下示例所示。您将看到两个节点都处于联机状态,并会看到完整的资源列表。

prihana:~ # crm_mon -r Stack: corosync Current DC: prihana (version 1.1.18+20180430.b12c320f5-3.24.1-b12c320f5) - partition with quorum Last updated: Wed Nov 11 16:20:40 2020 Last change: Wed Nov 11 16:20:21 2020 by root via crm_attribute on sechana 2 nodes configured 0 resources configured Online: [ prihana sechana ] Full list of resources: No resources

您可以使用corosync-cfgtool命令查找群集的振铃状态和关联的 IP 地址,如以下示例所示:

prihana:~ # corosync-cfgtool -s Printing ring status. Local node ID 1 RING ID 0 id = 11.0.1.132 status = ring 0 active with no faults RING ID 1 id = 11.0.1.75 status = ring 1 active with no faults