跳到主要内容

配置高可用性(HA)冗余组

在本节中,您将学习如何设置Solace PubSub+软件事件代理的高可用性(HA)冗余组。

本主题中显示的步骤通常适用于HA组配置,但如果您需要在Windows或macOS平台上设置HA组,可以在以下页面找到特定于该操作的说明:

  • Windows平台上的HA组配置
  • macOS平台上的HA组配置

如果您有兴趣在AWS上设置HA组,请查看以下GitHub上的快速入门,它将指导您完成HA配置的步骤:

  • 使用AWS Cloud Formation安装和配置Solace PubSub+软件事件代理的HA组

尽管本主题中的示例使用了Solace CLI,但其目的是帮助您熟悉HA配置,作为使用更高级、面向生产的技术的一步。例如,您还可以使用配置密钥来启动HA组,如使用配置密钥配置HA组中所述。

第1步:审查先决条件和配置参数锚点

在配置HA冗余组之前,您需要审查以下内容:

  • 先决条件
  • 配置参数
  • 使用桥接网络时的考虑事项

先决条件锚点

本节提供的配置步骤假设:

  • 您已获得Solace PubSub+软件事件代理包。要下载软件事件代理包的副本,请访问Solace PubSub+软件事件代理下载页面。
  • 将在HA冗余组中使用的软件事件代理使用:
    • 配置默认值。
    • 主机网络和单租户主机。

关于上述假设,唯一需要的配置更改如下:

  1. HA冗余组中的每个软件事件代理都配置有唯一的主机和路由器名称(参见主机名配置)。
  2. HA冗余组中的每个软件事件代理都配置有与管理VRF相关联的唯一IP地址。
  3. HA冗余组中的所有软件事件代理必须具有相同的发布版本。
  4. HA组中配置的所有消息节点使用相同的最大客户端连接数。当升级HA组的监控节点到Solace PubSub+版本8.10或更高版本时,数据库将转换为使用100作为最大客户端连接数(参见系统资源需求)。
  5. 主事件代理和备份事件代理的系统时钟与网络时间协议(NTP)服务器同步(参见与NTP服务器同步时钟的软件事件代理部分)。
  6. HA冗余组中的每个软件事件代理都部署在不同的物理主机系统上。
  7. 主事件代理和备份事件代理在相同的虚拟机上运行(具有相同数量的虚拟RAM和相同数量的虚拟处理器核心),并使用相同大小的磁盘用于它们的消息池。
  8. 如果您在云环境中部署HA冗余组,您必须确保为端口8300、8301、8302(三个HA配置同步端口)、8741(HA配对链接端口)和55555(SMF端口)创建安全规则。有关详细信息,请参见下表中显示的防火墙规则。
  9. 在本节讨论的示例中,使用了默认的HA配对链接端口。如果您需要在部署中使用其他端口,您需要使用configure/redundancy/mate-link/port <port> Solace CLI命令设置值。有关命令的更多信息,您可以在软件事件代理CLI命令中查找。

Solace PubSub+软件事件代理的入站防火墙规则 1

权限协议目的地端口
允许TCPSolace PubSub+软件事件代理2 IP
监控节点IPSolace PubSub+软件事件代理1 IP8300
允许TCP和UDPSolace PubSub+软件事件代理2 IP
监控节点IPSolace PubSub+软件事件代理1 IP8301
允许TCP和UDPSolace PubSub+软件事件代理2 IP
监控节点IPSolace PubSub+软件事件代理1 IP8302
允许TCPSolace PubSub+软件事件代理2 IPSolace PubSub+软件事件代理1 IP8741
允许TCPSolace PubSub+软件事件代理2 IPSolace PubSub+软件事件代理1 IP55555

Solace PubSub+软件事件代理的入站防火墙规则 2

权限协议目的地端口
允许TCPSolace PubSub+软件事件代理1 IP
监控节点IPSolace PubSub+软件事件代理2 IP8300
允许TCP和UDPSolace PubSub+软件事件代理1 IP
监控节点IPSolace PubSub+软件事件代理2 IP8301
允许TCP和UDPSolace PubSub+软件事件代理1 IP
监控节点IPSolace PubSub+软件事件代理2 IP8302
允许TCPSolace PubSub+软件事件代理1 IPSolace PubSub+软件事件代理2 IP8741
允许TCPSolace PubSub+软件事件代理1 IPSolace PubSub+软件事件代理2 IP55555

监控节点的入站防火墙规则

权限协议目的地端口
允许TCPSolace PubSub+软件事件代理1 IP
Solace PubSub+软件事件代理2 IP监控节点IP8300
允许TCP和UDPSolace PubSub+软件事件代理1 IP
Solace PubSub+软件事件代理2 IP监控节点IP8301
允许TCP和UDPSolace PubSub+软件事件代理1 IP
Solace PubSub+软件事件代理2 IP监控节点IP8302

配置参数锚点

以下表格列出了配置过程中所需的参数值。

参数描述示例值
接口名称管理VRF使用的接口名称。
要确定名称,请输入show ip vrf management命令——它是在Interface列中显示的名称,不包括“:<#>”后缀。intf0示例值
IP接口名称IP接口名称是接口名称与“:1”连接。intf0:1
预共享认证密钥32到256字节的二进制数据,以base 64编码。必须对HA组的所有成员相同。MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEK
IP地址Solace PubSub+软件事件代理的唯一IP地址/子网。
要确定IP地址,请输入show ip vrf management命令——它是输出中Static V Router显示的IP地址。主软件事件代理:192.168.132.16/20
备份软件事件代理:192.168.132.39/20
监控节点:192.168.132.3/20
HA冗余组参数Solace PubSub+软件事件代理名称,IP地址或完全限定域名(FQDN),以及每个节点的端口号。
  • 节点名称必须与管理路由器名称相同。
  • 冗余需要三个端口,这些端口必须能够被冗余组中的所有节点访问。端口8300默认设置,另外两个端口根据需要使用。 | 主事件代理:solace1connect-via 192.168.132.16
    备份事件代理:solace2connect-via 192.168.132.39
    监控节点:solace3connect-via 192.168.132.3 | | 为每个节点分配的节点角色。 | 主:active-standby-role primary
    备份:active-standby-role backup
    监控:监控节点没有分配active-standby-role。 |

使用桥接网络时的考虑事项锚点

如果您配置Solace PubSub+软件事件代理容器使用桥接网络,必须发布三个冗余端口(默认为8300、8301、8302)。您应确保以下端口可以访问:

  • 端口8300必须发布为TCP
  • 端口8301和8302必须发布为TCP和UDP

例如,docker create API支持-p标志或--publish标志来发布端口。典型的docker create命令行将包括:-p 8300:8300 -p 8301:8301 -p 8302:8302 -p 8301:8301/udp -p 8302:8302/udp

有关在HA组配置中使用桥接网络的更多信息,请参见容器网络。

第2步:配置节点锚点

要配置HA冗余组,您必须为主备和监控节点配置直接消息传递。配置完所有三个节点后,它们将有效地启用直接消息传递。

要配置Solace PubSub+软件事件代理冗余节点,请按顺序执行以下步骤:

  1. 配置主事件代理
  2. 配置备份事件代理
  3. 配置监控节点

在配置Solace PubSub+软件事件代理冗余之前,建议您首先关闭消息池。

配置主事件代理锚点

要为HA冗余组配置主事件代理,请执行以下步骤:

  1. 在将作为主事件代理的事件代理(示例中的solace1)上,关闭消息池:
solace1> enable
solace1# configure
solace1(configure)# hardware message-spool shutdown
All message spooling will be stopped.
Do you want to continue (y/n)? y
  1. 配置主机列表故障转移机制:
solace1(configure)# redundancy
solace1(configure/redundancy)# switchover-mechanism hostlist
solace1(configure/redundancy)# exit
  1. 配置HA冗余组,为主事件代理分配active-standby-roleprimary,然后启用冗余:
solace1(configure)# redundancy
solace1(configure/redundancy)# group
solace1(configure/redundancy/group)# create node solace1
solace1(configure/redundancy/group/node)# connect-via 192.168.132.16
solace1(configure/redundancy/group/node)# node-type message-routing-node
solace1(configure/redundancy/group/node)# exit
solace1(configure/redundancy/group)# create node solace2
solace1(configure/redundancy/group/node)# connect-via 192.168.132.39
solace1(configure/redundancy/group/node)# node-type message-routing-node
solace1(configure/redundancy/group/node)# exit
solace1(configure/redundancy/group)# create node solace3
solace1(configure/redundancy/group/node)# connect-via 192.168.132.3
solace1(configure/redundancy/group/node)# node-type monitor-node
solace1(configure/redundancy/group/node)# exit
solace1(configure/redundancy/group)# exit
solace1(configure/redundancy)# authentication
solace1(configure/redundancy/authentication)# pre-shared-key key <pre-shared-key>
solace1(configure/redundancy/authentication)# exit
solace1(configure/redundancy)# active-standby-role primary
solace1(configure/redundancy)# no shutdown

其中:

<pre-shared-key>是44到344个字符(相当于32到256字节的二进制数据,以base 64编码)。它用于在HA组的节点之间提供认证,并且必须在每个节点上相同。

在9.1.0及更早版本中,您必须使用redundancy group password <password>命令配置节点之间的组密码。在这些版本中,组密码必须在1到128个字符之间,并且必须在每个节点上相同。

配置备份事件代理锚点

要为HA冗余组配置备份事件代理,请执行以下步骤:

  1. 在将作为备份事件代理的事件代理(示例中的solace2)上,关闭消息池:
solace2> enable
solace2# configure
solace2(configure)# hardware message-spool shutdown
All message spooling will be stopped
Do you want to continue (y/n)? y
  1. 配置主机列表作为故障转移机制:
solace2(configure)# redundancy
solace2(configure/redundancy)# switchover-mechanism hostlist
  1. 配置HA冗余组,为备份事件代理分配active-standby-rolebackup,然后启用冗余:
solace2(configure)# redundancy
solace2(configure/redundancy)# group
solace2(configure/redundancy/group)# create node solace1
solace2(configure/redundancy/group/node)# connect-via 192.168.132.16
solace2(configure/redundancy/group/node)# node-type message-routing-node
solace2(configure/redundancy/group/node)# exit
solace2(configure/redundancy/group)# create node solace2
solace2(configure/redundancy/group/node)# connect-via 192.168.132.39
solace2(configure/redundancy/group/node)# node-type message-routing-node
solace2(configure/redundancy/group/node)# exit
solace2(configure/redundancy/group)# create node solace3
solace2(configure/redundancy/group/node)# connect-via 192.168.132.3
solace2(configure/redundancy/group/node)# node-type monitor-node
solace2(configure/redundancy/group/node)# exit
solace2(configure/redundancy/group)# exit
solace2(configure/redundancy)# authentication
solace2(configure/redundancy/authentication)# pre-shared-key key <pre-shared-key>
solace2(configure/redundancy/authentication)# exit
solace2(configure/redundancy)# active-standby-role backup
solace2(configure/redundancy)# no shutdown

其中:

<pre-shared-key>是44到344个字符(相当于32到256字节的二进制数据,以base 64编码)。它用于在HA组的节点之间提供认证,并且必须在每个节点上相同。

在9.1.0及更早版本中,您必须使用redundancy group password <password>命令配置节点之间的组密码。在这些版本中,组密码必须在1到128个字符之间,并且必须在每个节点上相同。

配置监控节点锚点

要为HA冗余组配置监控节点,请执行以下步骤:

  1. 在将作为监控节点的事件代理(示例中的solace3)上,重新加载默认配置:
solace3# reload default-config monitoring-node
This command causes a reload of the system
Do you want to continue (y/n)? y

对于作为容器运行的Solace PubSub+软件事件代理,在为监控节点重新加载默认配置后,您必须手动启动容器。

  1. 配置主机列表故障转移机制:
solace3(configure)# redundancy
solace3(configure/redundancy)# switchover-mechanism hostlist
  1. 配置HA冗余组并启用冗余。

注意,作为监控节点,此事件代理没有分配active-standby-role。

solace3(configure)# redundancy
solace3(configure/redundancy)# group
solace3(configure/redundancy/group)# create node solace1
solace3(configure/redundancy/group/node)# connect-via 192.168.132.16
solace3(configure/redundancy/group/node)# node-type message-routing-node
solace3(configure/redundancy/group/node)# exit
solace3(configure/redundancy/group)# create node solace2
solace3(configure/redundancy/group/node)# connect-via 192.168.132.39
solace3(configure/redundancy/group/node)# node-type message-routing-node
solace3(configure/redundancy/group/node)# exit
solace3(configure/redundancy/group)# create node solace3
solace3(configure/redundancy/group/node)# connect-via 192.168.132.3
solace3(configure/redundancy/group/node)# node-type monitor-node
solace3(configure/redundancy/group/node)# exit
solace3(configure/redundancy/group)# exit
solace3(configure/redundancy)# authentication
solace3(configure/redundancy/authentication)# pre-shared-key key <pre-shared-key>
solace3(configure/redundancy/authentication)# exit
solace3(configure/redundancy)# no shutdown

其中:

<pre-shared-key>是44到344个字符(相当于32到256字节的二进制数据,以base 64编码)。它用于在HA组的节点之间提供认证,并且必须在每个节点上相同。

在9.1.0及更早版本中,您必须使用redundancy group password <password>命令配置节点之间的组密码。在这些版本中,组密码必须在1到128个字符之间,并且必须在每个节点上相同。

第3步:启用保证消息传递锚点

默认情况下,HA组的保证消息传递被禁用。只有在主、备和监控节点配置了冗余后,才能启用保证消息传递,尽管使用保证消息传递是可选的,但建议启用,因为它是组必须满足的要求:

  • 接受发送或接收保证消息的客户端。
  • 使用Config-Sync。

在9.2.0之前的版本中,使用mate-link connect-via [<addr-port>]来启动配对链接连接。在9.2.0及更高版本中,mate-link connect via命令已被弃用,而是默认使用组节点的connect-via地址。在下面的示例中,使用了默认的HA配对链接端口,如果您需要在部署中使用其他端口,请执行configure/redundancy/mate-link/port <port> Solace CLI命令设置值。

要在HA组上启用保证消息传递,请在主、备事件代理上执行以下步骤:

  1. 在两个事件代理上启用消息池。

在主事件代理上,输入以下命令:

solace1(configure)# hardware message-spool
solace1(configure/hardware/message-spool)# no shutdown
solace1(configure/hardware/message-spool)# exit
solace1(configure/hardware)# exit

在备份事件代理上,输入以下命令:

solace2(configure)# hardware message-spool
solace2(configure/hardware/message-spool)# no shutdown
solace2(configure/hardware/message-spool)# exit
solace2(configure/hardware)# exit
  1. 在两个事件代理上启动配对链接服务。

在主事件代理上,输入以下命令:

solace1(configure)# service mate-link
solace1(configure/service/mate-link)# no shutdown
solace1(configure/service/mate-link)# exit
solace1(configure/service)# exit

在备份事件代理上,输入以下命令:

solace2(configure)# service mate-link
solace2(configure/service/mate-link)# no shutdown
solace2(configure/service/mate-link)# exit
solace2(configure/service)# exit
  1. 可选:您可以在配对链接上启用加密。

在主事件代理上,输入以下命令:

solace1(configure)# redundancy mate-link
solace1(configure/redundancy/mate-link)# ssl
solace1(configure/redundancy/mate-link)# exit
solace1(configure/redundancy)# exit

在备份事件代理上,输入以下命令:

solace2(configure)# redundancy mate-link
solace2(configure/redundancy/mate-link)# ssl
solace2(configure/redundancy/mate-link)# exit
solace2(configure/redundancy)# exit
  1. 要验证组的保证消息传递是否启用,请使用show redundancy命令。您需要查看的值是ADB Link To MateADB Hello To MateMessage Spool Status

在主事件代理上,您应该看到UpAD-Active

solace1(configure/redundancy)# show redundancy
Configuration Status : Enabled

. . .

ADB Link To Mate : Up
ADB Hello To Mate : Up

. . .

Message Spool Status AD-Active

同样,在备份事件代理上,您应该看到UpAD-Standby

solace2(configure/redundancy)# show redundancy
Configuration Status : Enabled

. . .

ADB Link To Mate : Up
ADB Hello To Mate : Up

. . .

Message Spool Status AD-Standby

第4步:启用Config-Sync锚点

在配置Solace PubSub+软件事件代理HA冗余组以支持保证消息传递后,使用Config-Sync在主备事件代理之间同步配置。

要启用Config-Sync,请确保允许主备事件代理连接的入站TCP规则端口55555。有关更多信息,请参见先决条件。

不使用TLS设置Config-Sync锚点

要为HA组启用Config-Sync,请执行以下步骤:

  1. 启用Config-Sync。

在主事件代理(solace1)上输入以下命令:

solace1(configure)# config-sync
solace1(configure/config-sync)# no shutdown
solace1(configure/config-sync)# exit
solace1(configure)# exit

在备份事件代理(solace2)上输入以下命令:

solace2(configure)# config-sync
solace2(configure/config-sync)# no shutdown
solace2(configure/config-sync)# exit
solace2(configure)# exit
  1. 断言主事件代理的配置。

当您首次在HA对上启用Config-Sync时,您必须断言领导事件代理(通常是HA对中的主事件代理)的系统级配置覆盖其配对。

作为此操作的结果,Config-Sync的Oper Status应该在主备事件代理上从Down变为Up(使用show config-sync用户执行命令检查)。

solace1# admin
solace1(admin)# config-sync
solace1(admin/config-sync)# assert-leader router
Processed 1 config-sync tables.
  1. 断言一个消息VPN的配置。

如果消息VPN的配置不同步,您必须在两个事件代理之间手动同步一个消息VPN配置。为此,您必须选择一个消息VPN作为领导者(不必在领导者或主事件代理上),并断言其配置覆盖另一个事件代理上的相同消息VPN。

solace1(admin/config-sync)# assert-leader message-vpn myvpn
WARNING: This command can temporarily disconnect clients on the AD-inactive appliance. As well in-flight messages may not be delivered
to AD endpoints on the AD-active appliance if those endpoints are not currently configured the same as they are on this appliance.
Do you want to continue (y/n)? y
Processed 1 config-sync tables.

通过TLS设置Config-Sync锚点

要为HA组启用通过TLS的Config-Sync,请执行以下步骤。

所有事件代理在HA组中必须配置相同的预共享认证密钥,如前几步所示,才能启用通过TLS的Config-Sync。

  1. 启用Config-Sync。

在主事件代理(solace1)上输入以下命令:

solace1(configure)# config-sync
solace1(configure/config-sync)# ssl
solace1(configure/config-sync)# no shutdown
solace1(configure/config-sync)# exit
solace1(configure)# exit

在备份事件代理(solace2)上输入以下命令:

solace2(configure)# config-sync
solace2(configure/config-sync)# ssl
solace2(configure/config-sync)# no shutdown
solace2(configure/config-sync)# exit
solace2(configure)# exit
  1. 断言主事件代理的配置。

当您首次在HA对上启用Config-Sync时,您必须断言领导事件代理(通常是HA对中的主事件代理)的系统级配置覆盖其配对。

作为此操作的结果,Config-Sync的Oper Status应该在主备事件代理上从Down变为Up(使用show config-sync用户执行命令检查)。

solace1# admin
solace1(admin)# config-sync
solace1(admin/config-sync)# assert-leader router
Processed 1 config-sync tables.
  1. 断言一个消息VPN的配置。

如果消息VPN的配置不同步,您必须在两个事件代理之间手动同步一个消息VPN配置。为此,您必须选择一个消息VPN作为领导者(不必在领导者或主事件代理上),并断言其配置覆盖另一个事件代理上的相同消息VPN。

solace1(admin/config-sync)# assert-leader message-vpn myvpn
WARNING: This command can temporarily disconnect clients on the AD-inactive appliance. As well in-flight messages may not be delivered
to AD endpoints on the AD-active appliance if those endpoints are not currently configured the same as they are on this appliance.
Do you want to continue (y/n)? y
Processed 1 config-sync tables.

第5步:验证故障转移锚点

要验证HA组的故障转移操作,请执行以下步骤:

  1. 手动释放主事件代理的活动(参见释放事件代理活动),并测试备份事件代理是否正在发布和接收消息。
solace1> enable
solace1# configure
solace1(configure)# redundancy
solace1(configure/redundancy)# release-activity

请注意,在运行release-activity命令后,备份节点将处于活动状态,但冗余将处于关闭状态。您必须运行no release-activity,如第3步所示,以确保主节点重新加入HA组,并且冗余恢复正常。

  1. 验证所有客户端在主事件代理活动释放后成功重新连接到备份事件代理,并测试消息继续按预期发布和接收。

使用show stats client命令检查备份事件代理上的客户端连接。备份事件代理上的连接客户端总数必须与主事件代理上的相同。

  1. 手动将活动重新带回主事件代理。
solace1(configure/redundancy)# no release-activity
solace1(configure/redundancy)# home
  1. 强制备份事件代理放弃活动(参见强制备份放弃活动给主)。
solace2> enable
solace2# admin
solace2(admin)# redundancy
solace2(admin/redundancy)# revert-activity
  1. 验证所有客户端在备份事件代理活动释放后重新连接回主事件代理,并测试消息继续按预期发布和接收。

使用show stats client命令检查主事件代理上的客户端连接。

下一步锚点

您现在已配置了三个Solace PubSub+软件事件代理在HA组中。您现在可以执行以下操作,如使用SDKPerf工具测试消息传递,配置事件代理的健康状况检查相关设置,或配置客户端连接的最大数量。

  • 下载SDKPerf - 要开始,请参见SDKPerf的快速入门指南。
  • 负载均衡器健康检查 - 如果Solace PubSub+软件事件代理与环境提供的负载均衡器一起运行,建议查看负载均衡器健康检查功能页面。
  • 扩展现有HA组 - 使用Solace CLI为HA冗余组配置系统扩展参数。