跳到主要内容

在软件事件代理HA冗余组中替换节点

您可以替换Solace PubSub+软件事件代理高可用性(HA)冗余组中的任意节点。请注意,HA冗余组中的所有事件代理必须使用相同的SolOS版本。以下程序解释了如何使用新默认配置的节点替换节点。

  • 替换主软件事件代理
  • 替换备份软件事件代理
  • 替换监控节点

当您在软件事件代理HA冗余组中替换节点时,如果新节点使用的IP地址、完全限定域名(FQDN)或主机名与它替换的节点不同,客户端将失去连接,他们必须重新配置以使用新的IP地址、FQDN或主机名。

替换主软件事件代理锚点

要替换HA组中的主软件事件代理,请执行以下步骤:

  1. 关闭主事件代理(本例中为solace1),以便客户端不再能够访问它:

如果您正在运行容器,请使用适当的命令停止容器。例如,使用Docker Engine,您可以使用stop命令:

sudo docker stop [OPTIONS] CONTAINER [CONTAINER...]
  1. 在将作为新主的事件代理上,从Solace CLI关闭消息池:
solace1-new> enable
solace1-new# configure
solace1-new(configure)# hardware message-spool shutdown
所有消息池将被停止
是否继续 (y/n)? y
  1. 关闭消息骨干服务:
solace1-new(configure)# service
solace1-new(configure/service)# msg-backbone
solace1-new(configure/service/msg-backbone)# shutdown
所有客户端将被断开连接
是否继续 (y/n)? y
  1. 配置所需的TLS/SSL服务和受信任的CA证书。有关更多信息,请参见TLS/SSL服务连接和管理服务器证书。
  2. 配置故障转移机制:
solace1-new(configure)# redundancy
solace1-new(configure/redundancy)# switchover-mechanism hostlist
  1. 配置HA冗余组,为主事件代理分配active-standby-role为主,并启用冗余:
solace1-new(configure/redundancy)# group
solace1-new(configure/redundancy/group)# create node solace1-new
solace1-new(configure/redundancy/group/node)# connect-via 192.168.132.116
solace1-new(configure/redundancy/group/node)# node-type message-routing-node
solace1-new(configure/redundancy/group/node)# exit
solace1-new(configure/redundancy/group)# create node solace2
solace1-new(configure/redundancy/group/node)# connect-via 192.168.132.39
solace1-new(configure/redundancy/group/node)# node-type message-routing-node
solace1-new(configure/redundancy/group/node)# exit
solace1-new(configure/redundancy/group)# create node solace3
solace1-new(configure/redundancy/group/node)# connect-via 192.168.132.3
solace1-new(configure/redundancy/group/node)# node-type monitor-node
solace1-new(configure/redundancy/group/node)# exit
solace1-new(configure/redundancy)# authentication
solace1-new(configure/redundancy/authentication)# pre-shared-key key <pre-shared-key>
solace1-new(configure/redundancy/group)# exit
solace1-new(configure/redundancy)# active-standby-role primary
solace1-new(configure/redundancy)# no shutdown

其中:

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

  1. 如果主事件代理的IP地址、FQDN或主机名与它替换的节点不同,则必须在备份和监控节点上更新冗余组信息。但是,如果主节点将使用与它替换的节点相同的IP地址或FQDN和主机名,则跳至第8步。

  2. 在两个事件代理上关闭冗余。 在备份事件代理上:

    solace2> enable
    solace2# configure
    solace2(configure)# redundancy
    solace2(configure/redundancy)# shutdown

    在监控节点上:

    solace3> enable
    solace3# configure
    solace3(configure)# redundancy
    solace3(configure/redundancy)# shutdown
  3. 在两个事件代理上从冗余组中移除旧节点。 在备份事件代理上:

    solace2(configure/redundancy)# group
    solace2(configure/redundancy/group)# no node solace1

    在监控节点上:

    solace3(configure/redundancy)# group
    solace3(configure/redundancy/group)# no node solace1
  4. 在两个事件代理上使用新的主机名和IP地址或FQDN创建新组节点。 在备份事件代理上:

    solace2(configure/redundancy/group)# create node solace1-new
    solace2(configure/redundancy/group/node)# connect-via 192.168.132.116
    solace2(configure/redundancy/group/node)# node-type message-routing-node
    solace2(configure/redundancy/group/node)# exit

    在监控节点上:

    solace3(configure/redundancy/group)# create node solace1-new
    solace3(configure/redundancy/group/node)# connect-via 192.168.132.116
    solace3(configure/redundancy/group/node)# node-type message-routing-node
    solace3(configure/redundancy/group/node)# exit
  5. 在备份事件代理上重新配置指向主事件代理(solace1-new)的配对链接:

    solace2(configure)# service mate-link
    solace2(configure/service/mate-link)# shutdown
    solace2(configure/redundancy)# mate-link connect-via 192.168.132.116:<port>
  6. 在备份和监控节点上启用冗余。

    在备份事件代理上:

    solace2(configure/redundancy)# no shutdown

    在监控节点上:

    solace3(configure/redundancy)# no shutdown
  7. 为使更改生效,重新加载备份节点:

    solace2(configure/redundancy)# reload
  8. 确认所有节点的冗余状态为Up

    在主事件代理上:

    solace1-new> show redundancy

    在备份事件代理上:

    solace2> show redundancy

    在监控节点上:

    solace3> show redundancy
  9. 在主事件代理上,释放活动:

    solace1-new> enable
    solace1-new# configure
    solace1-new(configure)# redundancy
    solace1-new(configure/redundancy)# release-activity
  10. 在主备事件代理上启用配对链接。

    在主事件代理上:

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

    在备份事件代理上:

    solace2(configure)# service mate-link
    solace2(configure/service/mate-link)# no shutdown
  11. 启用消息骨干服务:

    solace1-new> enable
    solace1-new# configure
    solace1-new(configure)# service
    solace1-new(configure/service)# msg-backbone
    solace1-new(configure/service/msg-backbone)# no shutdown
    solace1-new(configure/service/msg-backbone)# exit
    solace1-new(configure/service)# exit
  12. 启用消息池并验证消息池的操作状态AD-Active

    solace1-new(configure)# no hardware message-spool shutdown
    solace1-new> show message-spool
  13. 启用Config-Sync。

  • 设置不使用TLS的Config-Sync:
solace1-new> enable
solace1-new# configure
solace1-new(configure)# config-sync
solace1-new(configure/config-sync)# no shutdown
  • 设置通过TLS的Config-Sync:
solace1-new> enable
solace1-new# configure
solace1-new(configure)# config-sync
solace1-new(configure/config-sync)# ssl
solace1-new(configure/config-sync)# no shutdown
  1. 断言主事件代理为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 <vpn-name>
WARNING: This command can temporarily disconnect clients on the AD-inactive appliance. Clients connected to this appliance will not be affected.
Do you want to continue (y/n)? y
Processed 1 config-sync tables.

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

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

  1. 在主事件代理上释放活动:
solace1-new> enable
solace1-new# configure
solace1-new(configure)# redundancy
solace1-new(configure/redundancy)# release-activity

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

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

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

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

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

下一步锚点

您现在已在平台上运行HA冗余组,并启用了保证消息传递。您现在可以执行以下操作,例如使用SDKPerf工具测试消息传递,或测试HA组的故障转移操作。

  • 下载SDKPerf - 要开始,请参见SDKPerf的快速入门指南。
  • 验证故障转移 - 了解如何验证HA组的故障转移操作。

一旦您尝试了一些基本的HA相关功能,您可能会对一些更高级的HA主题感兴趣。

  • 监控冗余 - 了解如何查看HA配置和状态。
  • 扩展现有HA组 - 使用Solace CLI为HA冗余组配置系统扩展参数。