本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
群集节点设置
使用 Corosync 在节点之间建立集群通信并配置所需的身份验证。
部署多数制造商节点(仅限横向扩展集群)
注意
只有拥有两个以上节点的集群才需要此选项。
在中部署 SAP HANA Scale-Out 集群时 Amazon,必须在第三个可用区 (AZ) 中包含一个多数制造商节点。多数人(平局)节点通过保留法定人数来确保在一个可用区出现故障时集群保持正常运行。要使 Scale-Out 集群正常运行,必须至少运行一个可用区中的所有节点以及多数制造商节点。如果不满足此最低要求,则集群将失去其法定人数状态,所有剩余的 SAP HANA 节点都将被屏蔽。
多数制造商要求的最低 EC2 实例配置为 2 v CPUs、2 GB RAM 和 50 GB 磁盘空间;此实例专门用于法定人数管理,不托管 SAP HANA 数据库或任何其他集群资源。
更改黑群集密码
在所有群集节点上,更改操作系统用户 hacluster 的密码:
# passwd hacluster
设置无密码身份验证
为了更全面、更易于使用的集群活动视图,SUSE 提供了其他报告工具。其中许多工具都需要在不输入密码的情况下访问两个节点。SUSE 建议为 root 用户执行此设置。
有关更多详细信息,请参阅 SUSE 文档使用 hb_report for SLES HAE 中的 “以 root 用户身份收集集群报告的
警告
在实施此配置之前,请查看对组织的安全影响,包括根访问控制和网络分段。
配置群集节点
在第一个节点上初始化集群框架,包括所有已知的群集节点。
在主节点上以 root 身份运行:
# 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 配置
-
自动将第二个节点加入集群
-
我们
fence_aws
不会像在环境中用于 STONITH 那样配置 SBD。 Amazon -
QDevice 配置是可能的,但本文档中没有介绍。请参阅 SUSE Linux 企业高可用性文档- QDevice 和 QNet D
. -
对于具有两个以上节点的集群,可以在初始化期间使用其他
-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
更改是否已同步到辅助节点。您可能需要手动执行此操作。如果需要,请重新启动集群。
配置群集服务
启用起搏器在重启后自动启动:
# systemctl enable pacemaker
启用 pacemaker 还可以通过服务依赖关系处理 corosync。集群将在重启后自动启动。对于故障排除场景,您可以选择在启动后手动启动服务。
验证集群状态
1。查看起搏器服务状态:
# 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