回滚 Apigee Edge 4.54.00

如果您在更新到 Edge 4.54.00 期间遇到错误,可以回滚导致错误的组件,然后再次尝试更新。

您可以将 Edge 4.54.00 回滚到以下任一主要版本:

  • 版本 4.53.00
  • 版本 4.53.01

如需了解详情,请参阅 Apigee Edge 发布流程。

回滚顺序

组件的回滚应按照与升级相反的顺序进行。 Private Cloud 4.54.00 的典型回滚顺序如下所示:

  • 回滚 Cassandra、Zookeeper。
  • 回滚 Qpid、其他与分析相关的组件和 Postgres。
  • 回滚界面
  • 回滚 LDAP。
  • 回滚管理服务器。
  • 回滚路由器和消息处理器。

例如,假设您已将所有路由器和消息处理器、所有管理服务器、LDAP 和一些界面节点从 4.53.00(或 4.53.01)版本升级到 4.54.00 版本,并希望回滚。在这种情况下,您需要:

  • 回滚已升级的界面节点
  • 回滚 LDAP 节点
  • 逐个回滚管理服务器节点
  • 逐个回滚所有 RMP

谁可以执行回滚

执行回滚的用户应与最初更新 Edge 的用户相同,或以 root 身份运行的用户。

默认情况下,Edge 组件以用户“apigee”身份运行。在某些情况下,您可能以不同的用户身份运行 Edge 组件。例如,如果路由器必须访问特权端口(例如低于 1000 的端口),则您必须以 root 用户或有权访问这些端口的用户身份运行路由器。或者,您可能需要以一个用户的身份运行一个组件,并以另一个用户的身份运行另一个组件。

回滚 Cassandra

当在特定节点上执行 Cassandra 的重大升级时,Cassandra 会修改存储在该节点上的数据的架构。因此,无法直接就地回滚。

回滚场景

下表总结了您可以使用的回滚策略:

场景 回滚策略
单个数据中心,部分 Cassandra 节点已升级 使用备份
多个 DC,一个 DC 中的部分节点已升级 从现有 DC 重新构建
多个数据中心,部分数据中心内的所有 Cassandra 节点均已升级 从现有 DC 重新构建
多个数据中心,正在升级最后一个数据中心的 Cassandra 节点 尝试完成升级。如果不可行,请使用备份回滚 1 个数据中心。 从回滚的 DC 重新构建其余 DC。

一般注意事项

考虑回滚时,请注意以下几点:

  • 在 Cassandra 升级期间回滚 Cassandra:如果您在 Cassandra 升级期间遇到问题,不妨考虑回滚。根据升级过程中的状态,按照本文中的回滚策略进行操作。
  • 使用备份进行回滚:从 Cassandra 5.0.X 获取的备份与 Cassandra 4.0.X 的备份不兼容。如需使用备份恢复来回滚 Cassandra,您必须在尝试升级之前备份 Cassandra 4.0.X。

使用重建功能回滚 Cassandra

前提条件

  • 您正在跨多个数据中心运行 Edge for Private Cloud 4.53.00/4.53.01 集群。
  • 您正在将 Cassandra 从 4.0.X 升级到 5.0.X,并在升级过程中遇到了问题。
  • 集群中至少有一个功能齐全的数据中心仍在运行旧版 Cassandra (Cassandra 4.0.X)。

此程序依赖于来自现有数据中心的流式数据。这可能需要大量时间,具体取决于 Cassandra 中存储的数据量。您应做好准备,在回滚期间将运行时流量从该数据中心转移出去。

简要步骤

  1. 选择一个您要回滚的数据中心(部分或完全升级)。将运行时流量转移到其他正常运行的数据中心。
  2. 确定数据中心内的种子节点,并从其中一个种子节点开始。
  3. 停止、卸载和清理 Cassandra 节点。
  4. 在节点上安装旧版 Cassandra,并根据需要进行配置。
  5. 移除之前添加的额外配置。
  6. 对数据中心内的所有种子节点逐一重复上述步骤。
  7. 针对数据中心内的所有剩余 Cassandra 节点,逐一重复上述步骤。
  8. 从现有正常运行的数据中心逐个重新构建节点。
  9. 重启数据中心内连接到 Cassandra 的所有 edge-* 组件。
  10. 测试并将流量重新转移到此数据中心。
  11. 针对每个数据中心逐一重复执行上述步骤。

详细步骤

  1. 选择一个数据中心,在该数据中心内升级所有或部分 Cassandra 节点。在此数据中心内的 Cassandra 节点回滚期间,将所有运行时代理流量和管理流量从该数据中心转移出去。 确保在节点上执行 nodetool ring 命令时,所有 Cassandra 节点都处于 UN(启动/正常)状态。如果某些节点处于关闭状态,请先排查问题并使这些节点恢复运行,然后再继续。

    请参见下面的示例:

    /opt/apigee/apigee-cassandra/bin/nodetool status
    Datacenter: dc-1
    ================
    Status=Up/Down
    |/ State=Normal/Leaving/Joining/Moving
    --  Address      Load       Tokens       Owns (effective)  Host ID                               Rack
    UN  DC1-1IP1  456.41 KiB  1            100.0%            78fc4ddd-2ed9-4a8c-98a2-63a38c2f1920  ra-1
    UN  DC1-1IP2  870.93 KiB  1            100.0%            160db01a-64ab-43a7-b9ea-3b7f8f66d52b  ra-1
    UN  DC1-1IP3  824.08 KiB  1            100.0%            21d61543-d59e-403a-bf5d-bfe7f664baa6  ra-1
    Datacenter: dc-2
    ================
    Status=Up/Down
    |/ State=Normal/Leaving/Joining/Moving
    --  Address      Load       Tokens       Owns (effective)  Host ID                               Rack
    UN  DC2-1IP1   802.08 KiB  1            100.0%            583e0576-336d-4ce7-9729-2ae74e0abde2  ra-1
    UN  DC2-1IP2   844.4 KiB   1            100.0%            fef794d5-f4c2-4a4e-bb05-9adaeb4aea4b  ra-1
    UN  DC2-1IP3   878.12 KiB  1            100.0%            3894b3d9-1f5a-444d-83db-7b1e338bbfc9  ra-1

    您可以在节点上运行 nodetool describecluster,以了解整个集群的当前状态。例如,以下内容显示了一个双数据中心集群的实例,其中所有 DC-1 节点都运行 Cassandra 版本 4,而所有 DC-2 节点都运行 Cassandra 版本 3:

    # On nodes where Cassandra is upgraded
    /opt/apigee/apigee-cassandra/bin/nodetool describecluster
    Cluster Information:
        Name: Apigee
        Snitch: org.apache.cassandra.locator.PropertyFileSnitch
        DynamicEndPointSnitch: enabled
        Partitioner: org.apache.cassandra.dht.RandomPartitioner
        Schema versions:
            2eadcd74-0245-309a-9992-3625afa70038: [DC-1-IP1, DC-1-IP2, DC-1-IP3]
            129dc15e-198e-3c11-b64c-701044a3a1ad: [DC-2-IP1, DC-2-IP2, DC-2-IP3]
    
    Stats for all nodes:
        Live: 6
        Joining: 0
        Moving: 0
        Leaving: 0
        Unreachable: 0
    
    Data Centers:
        dc-1 #Nodes: 3 #Down: 0
        dc-2 #Nodes: 3 #Down: 0
    
    Database versions:
        5.0.8: [DC-1-IP1:7000, DC-1-IP2:7000, DC-1-IP3:7000]
        4.0.13: [DC-2-IP1:7000, DC-2-IP2:7000, DC-2-IP3:7000]
    
    Keyspaces:
        system_schema -> Replication class: LocalStrategy {}
        system -> Replication class: LocalStrategy {}
        auth -> Replication class: NetworkTopologyStrategy {dc-2=3, dc-1=3}
        cache -> Replication class: NetworkTopologyStrategy {dc-2=3, dc-1=3}
        devconnect -> Replication class: NetworkTopologyStrategy {dc-2=3, dc-1=3}
        dek -> Replication class: NetworkTopologyStrategy {dc-2=3, dc-1=3}
        user_settings -> Replication class: NetworkTopologyStrategy {dc-2=3, dc-1=3}
        apprepo -> Replication class: NetworkTopologyStrategy {dc-2=3, dc-1=3}
        kms -> Replication class: NetworkTopologyStrategy {dc-2=3, dc-1=3}
        identityzone -> Replication class: NetworkTopologyStrategy {dc-2=3, dc-1=3}
        audit -> Replication class: NetworkTopologyStrategy {dc-2=3, dc-1=3}
        analytics -> Replication class: NetworkTopologyStrategy {dc-2=3, dc-1=3}
        keyvaluemap -> Replication class: NetworkTopologyStrategy {dc-2=3, dc-1=3}
        counter -> Replication class: NetworkTopologyStrategy {dc-2=3, dc-1=3}
        apimodel_v2 -> Replication class: NetworkTopologyStrategy {dc-2=3, dc-1=3}
        system_distributed -> Replication class: SimpleStrategy {replication_factor=3}
        system_traces -> Replication class: SimpleStrategy {replication_factor=2}
        system_auth -> Replication class: SimpleStrategy {replication_factor=1}
    
    # On nodes where Cassandra is not upgraded
    /opt/apigee/apigee-cassandra/bin/nodetool describecluster
    Cluster Information:
        Name: Apigee
        Snitch: org.apache.cassandra.locator.PropertyFileSnitch
        DynamicEndPointSnitch: enabled
        Partitioner: org.apache.cassandra.dht.RandomPartitioner
        Schema versions:
            2eadcd74-0245-309a-9992-3625afa70038: [DC-1-IP1, DC-1-IP2, DC-1-IP3]
            129dc15e-198e-3c11-b64c-701044a3a1ad: [DC-2-IP1, DC-2-IP2, DC-2-IP3]
            
  2. 确定数据中心内的种子节点:请参阅附录中的如何确定种子节点部分。在其中一个种子节点上执行以下步骤:
  3. 停止、卸载并清理 Cassandra 节点中的数据。 在此数据中心内选择 Cassandra 5 版上的第一个种子节点。停止。
    # Stop Cassandra service on the node
    /opt/apigee/apigee-service/bin/apigee-service apigee-cassandra stop
    
    # Uninstall Cassandra software
    /opt/apigee/apigee-service/bin/apigee-service apigee-cassandra uninstall
    
    # Wipe out Cassandra data
    rm -rf /opt/apigee/data/apigee-cassandra
            
  4. 在节点上安装较旧的 Cassandra 软件并设置一些配置。 执行 Edge for Private Cloud 4.53.00/4.53.01 的引导文件。
  5. # Download bootstrap of 4.53.00
    curl https://software.apigee.com/bootstrap_4.53.00.sh -o /tmp/bootstrap_4.53.00.sh -u uName:pWord
    
    # Execute bootstrap of 4.53.00
    sudo bash /tmp/bootstrap_4.53.00.sh apigeeuser=uName apigeepassword=pWord
        
  6. 创建或修改文件 /opt/apigee/customer/application/cassandra.properties。
  7. 将以下内容添加到文件中。ipOfNode 是 Cassandra 用于与其他 Cassandra 节点通信的节点的 IP 地址:
    conf_jvm_options_custom_settings=-Dcassandra.replace_address=ipOfNode -Dcassandra.allow_unsafe_replace=true
  8. 确保该文件归 apigee 用户所有,并且可供该用户读取:
    chown apigee:apigee /opt/apigee/customer/application/cassandra.properties
  9. 安装和设置 Cassandra:
  10. # Install cassandra version 4.0.X
    /opt/apigee/apigee-service/bin/apigee-service apigee-cassandra install
    # Setup cassandra while passing standard configuration file
    /opt/apigee/apigee-service/bin/apigee-service apigee-cassandra setup -f configFile
    # Ensure Cassandra version is correct and service is running
    /opt/apigee/apigee-service/bin/apigee-service apigee-cassandra version
    /opt/apigee/apigee-service/bin/apigee-service apigee-cassandra status
  11. 验证节点是否已启动。在此节点和集群中的其他节点上检查以下命令。节点应报告其处于“UN”(启动/正常)状态:
    /opt/apigee/apigee-cassandra/bin/nodetool status
  12. 从文件 /opt/apigee/customer/application/cassandra.properties 中移除之前添加的额外配置。
  13. 在数据中心内的所有 Cassandra 种子节点上逐一重复执行第 3 步到第 10 步。
  14. 在数据中心内的所有其余 Cassandra 节点上逐一重复第 3 步到第 10 步。
  15. 从运行旧版 Cassandra 的数据中心重建数据中心内的所有节点。一次在一个节点上执行此步骤:
    /opt/apigee/apigee-cassandra/bin/nodetool rebuild -dc <name of working DC>

    此过程可能需要一些时间。您可以根据需要调整 streamingthroughput。检查 nodetool netstats 以了解操作完成状态。

  16. (可选)如果数据未重建,请在 Cassandra 节点中执行修复命令。
    /opt/apigee/apigee-cassandra/bin/nodetool -h node-IP repair -pr
  17. 逐个重启数据中心中的所有 edge-* 组件:
    /opt/apigee/apigee-service/bin/apigee-service edge-message-processor restart
    /opt/apigee/apigee-service/bin/apigee-service edge-router restart
    /opt/apigee/apigee-service/bin/apigee-service edge-management-server restart
    /opt/apigee/apigee-service/bin/apigee-service edge-qpid-server restart
    /opt/apigee/apigee-service/bin/apigee-service edge-postgres-server restart
  18. 验证并将流量重新导向此数据中心。在此数据中心内对运行时流量和管理 API 运行一些验证,并开始将代理和管理 API 流量重新路由回该数据中心。
  19. 对要回滚的每个数据中心重复上述步骤。

使用备份回滚 Cassandra

前提条件

  1. 您正在将 Cassandra 从 4.0.X 升级到 5.0.X,并在升级过程中遇到了问题。
  2. 您有要回滚的节点的备份。备份是在尝试从 4.0.X 升级到 5.0.X 之前进行的。

步骤

  1. 选择要回滚的一个节点。如果您要使用备份回滚数据中心中的所有节点,请先从种子节点开始。请参阅附录中的如何识别种子节点部分。

  2. 停止、卸载和清理 Cassandra 节点:

    # Stop Cassandra service on the node
    /opt/apigee/apigee-service/bin/apigee-service apigee-cassandra stop
    
    # Uninstall Cassandra software
    /opt/apigee/apigee-service/bin/apigee-service apigee-cassandra uninstall
    
    # Wipe Cassandra data
    rm -rf /opt/apigee/data/apigee-cassandra
  3. 在节点上安装较早的 Cassandra 软件并进行配置:

    • 执行 Edge for Private Cloud 4.53.00/4.53.01 的引导文件:
    • # Download bootstrap for 4.53.00
      curl https://software.apigee.com/bootstrap_4.53.00.sh -o /tmp/bootstrap_4.53.00.sh -u uName:pWord
      
      # Execute bootstrap for 4.53.00
      sudo bash /tmp/bootstrap_4.53.00.sh apigeeuser=uName apigeepassword=pWord
    • 创建或修改文件 /opt/apigee/customer/application/cassandra.properties:
    • conf_jvm_options_custom_settings=-Dcassandra.replace_address=ipOfNode -Dcassandra.allow_unsafe_replace=true
    • 确保该文件归 apigee 用户所有,并且可供读取:
    • chown apigee:apigee /opt/apigee/customer/application/cassandra.properties
    • 安装和设置 Cassandra:
    • # Install Cassandra version 4.0.X
      /opt/apigee/apigee-service/bin/apigee-service apigee-cassandra install
      
      # Set up Cassandra with the standard configuration file
      /opt/apigee/apigee-service/bin/apigee-service apigee-cassandra setup -f configFile
      
      # Verify Cassandra version and check service status
      /opt/apigee/apigee-service/bin/apigee-service apigee-cassandra version
      /opt/apigee/apigee-service/bin/apigee-service apigee-cassandra status

    验证节点是否已启动。在此节点和集群中的其他节点上检查以下命令。节点应报告此节点处于“UN”状态:

    /opt/apigee/apigee-cassandra/bin/nodetool status
  4. 停止 Cassandra 服务并恢复备份。如需了解详情,请参阅备份和恢复文档:

    # Stop Cassandra service on the node
    /opt/apigee/apigee-service/bin/apigee-service apigee-cassandra stop
    
    # Wipe the data directory in preparation for restore
    rm -rf /opt/apigee/data/apigee-cassandra/data
    
    # Restore the backup taken before the upgrade attempt
    /opt/apigee/apigee-service/bin/apigee-service apigee-cassandra restore backupFile
            
  5. 恢复备份后,移除其他配置:

    从文件 /opt/apigee/customer/application/cassandra.properties 中移除之前添加的配置。

  6. 在节点上启动 Cassandra 服务:

    /opt/apigee/apigee-service/bin/apigee-service apigee-cassandra start
  7. 在要使用备份回滚的每个 Cassandra 节点上重复上述步骤,一次一个。

  8. 恢复所有 Cassandra 节点后,逐个重启所有 edge-* 组件:

    /opt/apigee/apigee-service/bin/apigee-service edge-message-processor restart
    /opt/apigee/apigee-service/bin/apigee-service edge-router restart
    /opt/apigee/apigee-service/bin/apigee-service edge-management-server restart
    /opt/apigee/apigee-service/bin/apigee-service edge-qpid-server restart
    /opt/apigee/apigee-service/bin/apigee-service edge-postgres-server restart

备份优化(高级选项)

如果您有包含最新数据的副本,则可以在恢复备份时尽可能减少(或消除)数据丢失。如果有可用的副本,请在恢复备份后,对已恢复的节点运行修复。

附录

如何识别种子节点

在数据中心内的任何 Cassandra 节点上,运行以下命令:

/opt/apigee/apigee-service/bin/apigee-service apigee-cassandra configure -search conf_cassandra_seeds

该命令会输出多行内容。查看输出的最后一行。最后一行中列出的 IP 地址是种子节点。在以下示例中,DC-1-IP1、DC-1-IP2、DC-2-IP1 和 DC-2-IP2 是种子节点 IP:

Found key conf_cassandra_seeds, with value, "127.0.0.1", in /opt/apigee/apigee-cassandra/token/default.properties

Found key conf_cassandra_seeds, with value, 127.0.0.1, in /opt/apigee/apigee-cassandra/token/application/cassandra.properties

Found key conf_cassandra_seeds, with value, "DC-1-IP1, DC-1-IP2, DC-2-IP1, DC-2-IP2", in /opt/apigee/token/application/cassandra.properties
apigee-configutil: apigee-cassandra: # OK

回滚 ZooKeeper

回滚

如果需要回滚:

  1. 首先对观察者和跟随者执行回滚步骤。请参阅确定领导者、追随者和观察者,了解如何选择观察者和追随者。
  2. 下载并执行要回滚到的版本(4.53.00 或 4.53.01)的引导程序。 具体流程可能会因节点是否具有外部互联网连接或您是否在进行离线安装而异。
  3. 如果 Zookeeper 在节点上运行,请停止它:
      /opt/apigee/apigee-service/bin/apigee-service apigee-zookeeper stop
  4. 卸载现有的 Zookeeper:
      /opt/apigee/apigee-service/bin/apigee-service apigee-zookeeper uninstall
  5. 照常安装 Zookeeper:
      /opt/apigee/apigee-setup/bin/setup.sh -p zk -f <silent-config-file>
  6. 回滚所有跟随者和观察者后,在领导者节点上执行第 2 步到第 5 步,回滚领导者节点。
  7. 所有节点都回滚后,验证集群健康状况,并确保集群中有一个领导者节点。

恢复备份

请参阅使用备份进行恢复。

回滚 Qpid

如需回滚到之前的特性版本,请务必下载要回滚到的版本的 bootstrap.sh 文件。如需回滚到 v 4.53.00/4.53.01,请下载 bootstrap_4.53.00.sh。

如需回滚 Qpid,请在所有 Qpid 主机上按以下步骤操作:

  1. 停止现有 Qpid 代理:
    apigee-service apigee-qpidd stop
  2. 通过应用防火墙,阻止来自所有消息处理器的代理端口 5672 上的传入流量。您可以在 Qpid 节点实例级别或某些其他外部防火墙/网络组件级别应用此防火墙。

    建议您对所有消息处理器 IP 地址执行相同的步骤。例如,如需使用 IPTables 将来自消息处理器 IP 地址的请求丢弃到端口 5672 上的 Qpid 节点,您可以使用如下命令:

    iptables -A INPUT -p tcp --dport 5672 -s MESSAGE_PROCESSOR_IP -j DROP
  3. 再次启动 Qpid 代理以排空现有消息(如有):
    apigee-service apigee-qpidd start
  4. 确保现有队列为空。如需进行检查,请登录 Qpid 管理门户:
    http://QPID_NODE_IP:8090
  5. 验证队列已清空后,停止并卸载 Qpid:
    /opt/apigee/apigee-service/bin/apigee-service apigee-qpidd stop
    /opt/apigee/apigee-service/bin/apigee-service apigee-qpidd uninstall
  6. 删除 Qpid 数据目录:
    rm -r APIGEE_ROOT/data/apigee-qpidd
  7. 重新安装 Qpid 代理:
    /opt/apigee/apigee-setup/bin/setup.sh -p qs -f configFile
  8. 重新安装 Qpid 代理后,移除防火墙设置并使用以下命令列出所有现有设置:
    iptables -F
    iptables -L

回滚 Postgres

如需从版本 4.54.00 降级到版本 4.53.00/4.53.01,除了 Edge 组件之外,您还必须回滚 Postgres 更新。

如需在主备配置中更新 Postgres 时回滚 Postgres 更新,请执行以下操作:

  • 将新的备用节点提升为 Postgres 主节点。新的 Postgres 主实例将与您之前的 Edge 安装版本相同。
  • 将旧备用节点配置为新主节点的备用节点。旧备用节点将与之前的 Edge 安装版本相同。
  • 向分析和使用方群组注册新的主节点和备用节点。

回滚完成后,旧主节点将不再必要。然后,您可以停用旧的主节点。

准备工作

在将 Postgres 18 回滚到 17/14 之前,请在新待机主机和旧待机主机上执行以下步骤,以更新 apigee-postgresql 上的 max_locks_per_transaction 属性:

  1. 如果不存在,请创建文件 /opt/apigee/customer/application/postgresql.properties。
  2. 将此文件的所有权更改为 apigee:
    sudo chown apigee:apigee /opt/apigee/customer/application/postgresql.properties
  3. 将以下属性添加到该文件中:
    conf/postgresql.conf+max_locks_per_transaction=30000
  4. 配置 apigee-postgresql:
    apigee-service apigee-postgresql configure
  5. 重启 apigee-postgresql:
    apigee-service apigee-postgresql restart

详细的回滚程序

  1. 确保新的备用 Postgres 节点正在运行:
    /opt/apigee/apigee-service/bin/apigee-all status

    如果 Postgres 未运行,请启动它:

    /opt/apigee/apigee-service/bin/apigee-all start
  2. 确保在旧主节点和旧备用节点上停止 Postgres:
    /opt/apigee/apigee-service/bin/apigee-all status

    如果 Postgres 正在运行,请停止它:

    /opt/apigee/apigee-service/bin/apigee-service edge-postgres-server stop  
    /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql stop
  3. 如果已安装,请在旧备用节点上启动 Qpid:
    /opt/apigee/apigee-service/bin/apigee-service edge-qpid-server start
  4. 将新的备用节点提升为 Postgres 主节点:
    1. 将新的备用节点提升为新主节点:
      apigee-service apigee-postgresql promote-standby-to-master old_master_IP

      如果出现提示,请输入“apigee”用户的 Postgres 密码,默认为“postgres”。

    2. 修改用于安装当前 Edge 版本的配置文件,以指定以下内容:
      # IP address of the new master:
      PG_MASTER=new_standby_IP
      # IP address of the old standby node
      PG_STANDBY=old_standby_IP
    3. 配置新主设备:
      /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql setup-replication-on-master -f configFile
  5. 如果您已将旧备用节点升级到较新版本,则必须先在旧备用节点上降级 Apigee 软件。如果您仍有旧版本位于旧的备用节点上,则可以跳过此步骤,继续执行第 6 步。
    1. 在旧的备用节点上停止 Postgres:
      apigee-service apigee-postgresql stop
      apigee-service edge-postgres-server stop
    2. 从旧备用节点中卸载 Postgres:
      apigee-service apigee-postgresql uninstall
      apigee-service edge-postgres-server uninstall
      apigee-service edge-analytics uninstall
    3. 从旧备用节点中删除 Postgres 数据目录:
      cd /opt/apigee/data/apigee-postgresql/pgdata
      rm -rf *
    4. 在旧备用节点上下载并运行旧版引导程序(适用于您要回滚到的 Apigee 版本)。具体步骤可能会因您使用的是基于互联网的安装还是离线安装而有所不同。运行旧版 Apigee 引导程序将使用旧版 Apigee 数据设置 yum 代码库。
    5. 在旧备用节点上设置 Postgres 组件:
      /opt/apigee/apigee-setup/bin/setup.sh -p ps -f configFile
    6. 检查并验证旧备用节点上的 Postgres 组件是否已回滚到旧版本:
      apigee-service apigee-postgresql version
      apigee-service edge-postgres-server version
  6. 重建旧备用节点:
    1. 修改用于安装当前 Edge 版本的配置文件,以指定以下内容:
      # IP address of the new master:
      PG_MASTER=new_standby_IP
      # IP address of the old standby node
      PG_STANDBY=old_standby_IP
    2. 移除旧备用节点上的数据目录:
      cd /opt/apigee/data/apigee-postgresql/pgdata
      rm -rf *
    3. 将旧备用节点重新配置为新主节点的备用节点:
      /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql setup-replication-on-standby -f configFile
    4. 确保 Postgres 在旧备用节点上运行:
      /opt/apigee/apigee-service/bin/apigee-all status

      如果 Postgres 未运行,请启动它:

      /opt/apigee/apigee-service/bin/apigee-service edge-postgres-server start
  7. 通过查看新主节点上的 /opt/apigee/apigee-postgresql/conf/pg_hba.conf 文件,验证是否已添加新的备用节点。
  8. 在管理服务器上运行以下命令,查看当前的分析和使用方群组信息:
    curl -u sysAdminEmail:password http://ms_IP:8080/v1/analytics/groups/ax

    此命令会在 name 字段中返回分析组名称,并在 consumer-groups 下的 name 字段中返回消费者组名称。它还会在 postgres-server 字段和 datastores 字段中返回旧 Postgres 主节点和备用节点的 UUID。您应该会看到以下形式的输出:

    {
      "name" : "axgroup-001",
      "properties" : {
      },
      "scopes" : [ "VALIDATE~test", "sgilson~prod" ],
      "uuids" : {
        "qpid-server" : [ "8381a053-433f-4382-bd2a-100fd37a1592", "4b6856ec-ef05-498f-bac6-ef5f0d5f6521" ],
        "postgres-server" : [
          "ab1158bd-1d59-4e2a-9c95-24cc2cfa6edc:27f90844-efab-4b32-8a23-8f85cdc9a256"
        ]
      },
      "consumer-groups" : [ {
        "name" : "consumer-group-001",
        "consumers" : [ "8381a053-433f-4382-bd2a-100fd37a1592", "4b6856ec-ef05-498f-bac6-ef5f0d5f6521" ],
        "datastores" :
          [ "ab1158bd-1d59-4e2a-9c95-24cc2cfa6edc:27f90844-efab-4b32-8a23-8f85cdc9a256" ],
          "properties" : {     }
        }
      ],
      "data-processors" : {
      }
    }
  9. 在旧主节点上运行以下 curl 命令,获取旧主节点的 UUID 地址:
    curl -u sysAdminEmail:password http://node_IP:8084/v1/servers/self

    您应该会在输出末尾看到节点的 UUID,格式如下:

    "type" : [ "postgres-server" ],
    "uUID" : "599e8ebf-5d69-4ae4-aa71-154970a8ec75"
  10. 重复上一步,获取旧备用节点和新主节点的 IP 地址。
  11. 从使用方群组中移除旧的主节点和备用节点:
    curl -u sysAdminEmail:password -X DELETE \
      "http://ms_IP:8080/v1/analytics/groups/ax/axgroup-001/consumer-groups/consumer-group-001/datastores/masterUUID,standbyUUID" -v

    其中,axgroup-001 和 consumer-group-001 是分析组和消费组的默认名称。masterUUID,standbyUUID 的顺序与您在上面查看当前分析和使用方群组信息时显示的顺序相同。您可能需要将其指定为 standbyUUID,masterUUID。

    consumer-groups 的 datastores 属性现在应为空。

  12. 从分析组中移除旧的主节点和备用节点:
    curl -u sysAdminEmail:password -X DELETE \
      "http://ms_IP:8080/v1/analytics/groups/ax/axgroup-001/servers?uuid=masterUUID,standbyUUID&type=postgres-server" -v

    uuids 下的 postgres-server 属性现在应为空。

  13. 向分析和使用方群组注册新的 PG 主节点和备用节点:
    curl -u sysAdminEmail:password -X POST -H "Content-Type: application/json" -d ''
      "http://ms_IP:8080/v1/analytics/groups/ax/axgroup-001/servers?uuid=masterUUID,standbyUUID&type=postgres-server" -v
    curl -u sysAdminEmail:password -X POST -H "Content-Type:application/json" -d ''
      "http://ms_IP:8080/v1/analytics/groups/ax/axgroup-001/consumer-groups/consumer-group-001/datastores?uuid=masterUUID,standbyUUID" -v
  14. 验证分析组:
    curl -u sysAdminEmail:password http://ms_IP:8080/v1/analytics/groups/ax

    您应该会在分析组和消费者组中看到新主节点和备用节点的 UUID。

  15. 重启 Edge Management Server:
    /opt/apigee/apigee-service/bin/apigee-service edge-management-server restart
  16. 重启所有 Qpid 服务器:
    /opt/apigee/apigee-service/bin/apigee-service edge-qpid-server restart
  17. 重启所有 Postgres 服务器:
    /opt/apigee/apigee-service/bin/apigee-service edge-postgres-server restart
  18. 在两台服务器上运行以下脚本,验证复制状态。系统应在两个服务器上显示相同的结果,以确保复制成功:

    在新主实例上,运行以下命令:

    /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql postgres-check-master

    验证其是否为主实例。在旧备用节点上,运行以下命令:

    /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql postgres-check-standby

    验证其是否为备用实例。

  19. 在发出多个 API 请求后重复上一步,以确保节点同步。
  20. 停用旧的 Postgres 主节点:

    或者,您也可以从旧主节点卸载 Qpid,然后在新主节点上安装 Qpid。卸载 Qpid 后,您可以停用旧的主节点。

回滚新版 Edge 界面

Apigee Edge for Private Cloud 4.54.00 将传统版界面 (edge-ui) 替换为新版 Edge 界面 (edge-management-ui)。由于界面组件在 4.54.00 中发生了变化,因此回滚到 4.53.00 或 4.53.01 版需要卸载 edge-management-ui 并重新安装之前的界面配置文件:

  • 传统版界面 (edge-ui):重新安装 ui 配置文件。
  • 新 Edge 界面(edge-ui 和 edge-management-ui):在各自的节点中重新安装 ui 和 ue 配置文件。

如需在节点上回滚界面,请执行以下操作:

  1. 停止并卸载 4.54.00 New Edge 界面,然后安装先前版本以进行回滚:
    1. 停止并卸载 4.54.00 New Edge 界面 (edge-management-ui):
      /opt/apigee/apigee-service/bin/apigee-service edge-management-ui stop
      /opt/apigee/apigee-service/bin/apigee-service edge-management-ui uninstall
      /opt/apigee/apigee-service/bin/apigee-service edge-management-ui-static uninstall
    2. 执行适用于 Edge for Private Cloud 4.53.00/4.53.01 的引导文件:
      # Download bootstrap for 4.53.00
      curl https://software.apigee.com/bootstrap_4.53.00.sh -o /tmp/bootstrap_4.53.00.sh -u uName:pWord
      
      # Execute bootstrap for 4.53.00
      sudo bash /tmp/bootstrap_4.53.00.sh apigeeuser=uName apigeepassword=pWord
    3. 将 apigee-setup 从 4.54.00 回滚到先前版本:
      # Uninstall apigee-setup
      /opt/apigee/apigee-service/bin/apigee-service apigee-setup uninstall
      
      # Install apigee-setup
      /opt/apigee/apigee-service/bin/apigee-service apigee-setup install
  2. 恢复 4.53.00/4.53.01 界面配置:
    • 如果您备份了 4.53.00 或 4.53.01 安装中的静默配置文件,请使用该备份文件执行回滚过程。 否则,请在 4.54.00 静默配置文件中,恢复或取消注释在升级期间移除或注释掉的 4.53.00 或 4.53.01 界面属性。如需参考,请参阅界面升级部分。
    • 如果 /opt/apigee/customer/application/ui.properties 在升级期间被删除,请从备份目录中恢复:
      cp -rf /opt/apigee/backup/ui/customer/application/ui.properties /opt/apigee/customer/application/
      chown apigee:apigee /opt/apigee/customer/application/ui.properties
  3. 重新安装并配置之前的界面版本:
    • 回滚到传统版界面 (edge-ui):
      1. 安装并设置传统版界面(对于基本身份验证,无需执行其他步骤):
        /opt/apigee/apigee-setup/bin/setup.sh -p ui -f configFile
      2. 如果已启用 SSO,请在经典界面中配置 SSO(确保 apigee-sso 先运行):
        /opt/apigee/apigee-service/bin/apigee-service edge-ui configure-sso -f configFile
    • 回滚到 4.53.00 或 4.53.01 新版 Edge 界面(edge-management-ui 和 Shoehorn edge-ui):
      1. 确保在静默配置文件中设置了 EDGEUI_ENABLE_UNIFIED_UI=y,然后安装并设置 ui 和 ue 配置文件:
        /opt/apigee/apigee-setup/bin/setup.sh -p ui -f configFile
        /opt/apigee/apigee-setup/bin/setup.sh -p ue -f configFile
      2. 如果启用了单点登录,请在两个界面组件上配置单点登录(确保 apigee-sso 先运行):
        /opt/apigee/apigee-service/bin/apigee-service edge-ui configure-sso -f configFile
        /opt/apigee/apigee-service/bin/apigee-service edge-management-ui configure-sso -f configFile
  4. 验证回滚后的界面状态和版本:
    • 对于经典版界面 (edge-ui):
      /opt/apigee/apigee-service/bin/apigee-service edge-ui status
      /opt/apigee/apigee-service/bin/apigee-service edge-ui version
    • 对于新版 Edge 界面 (edge-management-ui):
      /opt/apigee/apigee-service/bin/apigee-service edge-management-ui status
      /opt/apigee/apigee-service/bin/apigee-service edge-management-ui version

回滚 OpenLDAP

本部分提供了一份分步指南,用于将 Edge for Private Cloud 4.54.00 中的 Symas OpenLDAP 2.6.10 回滚到 OpenLDAP 2.4.46(Edge for Private Cloud 4.53.00)或 Symas OpenLDAP 2.6.7(Edge for Private Cloud 4.53.01)。您必须使用有效的升级前 LDAP 备份对整个 LDAP 集群执行回滚。

主要目标是将整个 LDAP 集群从已知良好的备份恢复到一致状态。此过程对于所有场景(单服务器、活跃-活跃和活跃-非活跃)都是相同的。

准备工作

  • 备份不兼容:使用在尝试升级之前通过 apigee-service apigee-openldap backup 创建的 OpenLDAP 2.4.46(Edge for Private Cloud 4.53.00)或 Symas OpenLDAP 2.6.7(Edge for Private Cloud 4.53.01)升级前备份。升级后创建的备份不兼容,无法使用。
  • Management API 停机时间:在 LDAP 回滚期间,Management API 将不可用,这可能会影响管理任务。在继续执行 LDAP 回滚之前,请关闭所有 edge-management-server 和 edge-ui 实例。
  • 数据丢失风险:在没有有效且兼容的备份的情况下继续操作,可能会导致数据丢失且无法恢复。
  • 有效备份:必须有有效的升级前 LDAP 备份。
  • 备份 silent.conf 文件:保留先前版本和当前版本的 silent.conf 文件的备份,以防止在升级和回滚过程中出现配置混淆。
  • 回滚顺序:在回滚 OpenLDAP 之前,请先完成 Cassandra、ZooKeeper、Qpid、PostgreSQL、apigee-sso 和 Edge 界面的回滚过程。

回滚流程

  1. 关闭管理服务器和界面:在继续执行 LDAP 回滚之前,请关闭所有 edge-management-server 和 edge-ui 实例:
    apigee-service edge-management-server stop
    apigee-service edge-ui stop
  2. 记录当前的 LDAP 条目数(在停止 LDAP 之前):从所有 LDAP 服务器获取总记录数以供参考,将 YOUR_PASSWORD 替换为当前的 LDAP 管理员密码。(所有 LDAP 服务器上的记录数必须一致。)
    # Note: Replace 'YOUR_PASSWORD' with your current LDAP manager password.
    ldapsearch -o ldif-wrap=no -b "dc=apigee,dc=com" -D "cn=manager,dc=apigee,dc=com" -H ldap://:10389 -LLL -x -w 'YOUR_PASSWORD' | wc -l
  3. 停止并卸载新的 LDAP 2.6:停止 apigee-openldap 服务,并删除其配置和数据目录。在所有 LDAP 服务器上执行此步骤,每次在集群中执行一个节点,以确保一致性:
    apigee-service apigee-openldap stop
    apigee-service apigee-openldap uninstall
    rm -rf /opt/apigee/data/apigee-openldap/*
  4. 安装之前的 LDAP 版本 2.4.46 或 2.6.7:
    • 安装旧版 LDAP:
      /opt/apigee/apigee-setup/bin/setup.sh -p ld -f /opt/silent.conf
    • 验证 LDAP 版本:
      source ~/.bash_profile
      ldapsearch -VV
      
      # Expected output if rolled back to 4.53.00:
      ldapsearch: @(#) $OpenLDAP: ldapsearch 2.4.46
      
      # Expected output if rolled back to 4.53.01:
      ldapsearch: @(#) $OpenLDAP: ldapsearch 2.6.7
    • 在每个 LDAP 节点上重复执行第 4 步中的上述子步骤,一次一个。
  5. 清理残留数据:在所有 LDAP 服务器上,逐个停止新安装的服务并清理其数据目录,为从备份恢复做好准备:
    apigee-service apigee-openldap stop
    rm -rf /opt/apigee/data/apigee-openldap/*
  6. 恢复 LDAP 数据:对于单服务器设置,请直接前往第 6b 步。对于多服务器设置,请继续执行步骤 6a。
    1. 确定活跃的 LDAP 服务器:在恢复 LDAP 数据之前,请运行以下命令来确定活跃的服务器(提供方):
      grep -i '^olcSyncrepl:' /opt/apigee/data/apigee-openldap/slapd.d/cn=config/olcDatabase*.ldif
    2. 恢复 LDAP 数据(在恢复之前,请确保所有服务器都已完成第 5 步):
      • 在单个或活跃 LDAP 服务器(在步骤 6a 中确定)上,前往备份目录并恢复升级前备份(例如 2025.07.28,13.59.00,如果升级前备份是目录中的最新备份,则省略时间戳):
        cd /opt/apigee/backup/openldap
        
        # To restore a specific backup, provide the timestamp as shown below:
        apigee-service apigee-openldap restore 2025.07.28,13.59.00
        
        # Note: If no timestamp is provided, the latest available backup will be restored by default:
        apigee-service apigee-openldap restore
        
        # It is recommended to specify the backup explicitly to avoid restoring an unintended version.
      • 启动 apigee-openldap 服务:
        apigee-service apigee-openldap start
  7. 启动其余 LDAP 服务器:如果您采用多服务器设置,请在其余每个 LDAP 服务器上启动服务:
    apigee-service apigee-openldap start
  8. 最终验证:
    • 验证回滚是否成功,以及整个 LDAP 集群中的数据是否一致。
    • 在所有 LDAP 服务器上运行验证命令,并将 YOUR_PASSWORD 替换为您当前的 LDAP 管理员密码。所有服务器上的记录数必须相同,并且必须与您在第 2 步中捕获的记录数一致:
      # Note: Replace 'YOUR_PASSWORD' with your current LDAP manager password.
      ldapsearch -o ldif-wrap=no -b "dc=apigee,dc=com" -D "cn=manager,dc=apigee,dc=com" -H ldap://:10389 -LLL -x -w 'YOUR_PASSWORD' | wc -l
    • 确认数据正确且一致后,请按照贵组织的标准程序启动 edge-management-server、edge-ui 和任何其他相关组件。

回滚 Edge 组件

具有通用代码的组件

以下 Edge 组件共享通用代码。因此,如需在节点上回滚其中任何一个组件,您必须回滚该节点上的所有这些组件:

  • edge-management-server(管理服务器)
  • edge-message-processor(消息处理器)
  • edge-router(路由器)
  • edge-postgres-server(Postgres 服务器)
  • edge-qpid-server (Qpid 服务器)

例如,如果您在节点上安装了管理服务器、路由器和消息处理器,则要回滚其中任何一个,您必须回滚所有这三个。

如需回滚到之前的主要版本或次要版本,请在托管相应组件的每个节点上执行以下操作:

  1. 下载要回滚到的版本的 bootstrap.sh 文件:

    • 如需回滚到 4.53.00/4.53.01,请下载 bootstrap_4.53.00.sh/bootstrap_4.53.01.sh
  2. 停止要回滚的组件:
    1. 如需回滚节点上具有通用代码的任何组件,您必须停止所有这些组件,如以下示例所示:
      /opt/apigee/apigee-service/bin/apigee-service edge-management-server stop
      /opt/apigee/apigee-service/bin/apigee-service edge-router stop
      /opt/apigee/apigee-service/bin/apigee-service edge-message-processor stop
      /opt/apigee/apigee-service/bin/apigee-service edge-qpid-server stop
      /opt/apigee/apigee-service/bin/apigee-service edge-postgres-server stop
    2. 如需回滚节点上的任何其他组件,请仅停止该组件:
      /opt/apigee/apigee-service/bin/apigee-service component stop
  3. 如果您要回滚创收功能,请从所有管理服务器和消息处理器节点中卸载该功能:
    /opt/apigee/apigee-service/bin/apigee-service edge-mint-gateway uninstall
  4. 卸载要在节点上回滚的组件:
    1. 如需回滚节点上具有通用代码的任何组件,您必须通过卸载 edge-gateway 和 apigee-cassandra-client 组件组来卸载所有组件,如以下示例所示:
      /opt/apigee/apigee-service/bin/apigee-service edge-gateway uninstall
      /opt/apigee/apigee-service/bin/apigee-service apigee-cassandra-client uninstall
    2. 如需回滚 Nginx,请执行以下操作:
      ### Find the apigee-nginx RPM
      rpm -qa | grep -i "apigee-nginx"
      
      ### Remove the apigee-nginx RPM
      dnf remove apigee-nginx-1.30.x
      
    3. 如需回滚节点上的任何其他组件,请仅卸载该组件,如以下示例所示:
      /opt/apigee/apigee-service/bin/apigee-service component uninstall

      其中,component 是组件名称。

    4. 如需回滚 Edge 路由器,除了卸载 edge-gateway 组件组之外,您还必须删除 /opt/nginx/conf.d 文件的内容:
      cd /opt/nginx/conf.d
      rm -rf *
  5. 卸载 4.54.00 版 apigee-setup:
    /opt/apigee/apigee-service/bin/apigee-service apigee-setup uninstall
  6. 安装 4.53.00 版本的 apigee-service 实用程序及其依赖项。以下示例安装的是 4.53.00 版的 apigee-service:
    sudo bash /tmp/bootstrap_4.53.00.sh apigeeuser=uName apigeepassword=pWord

    其中,uName 和 pWord 是您从 Apigee 收到的用户名和密码。如果您省略 pWord,系统会提示您输入。

    如果您收到错误消息,请确保您在第 1 步中下载了 bootstrap.sh 文件。

  7. 安装 apigee-setup:
    /opt/apigee/apigee-service/bin/apigee-service apigee-setup install
  8. 安装旧版组件:
    /opt/apigee/apigee-setup/bin/setup.sh -p component -f configFile

    其中,component 是要安装的组件,configFile 是旧版本的配置文件。

  9. 如果您要回滚 Qpid,请刷新 iptables:
    sudo iptables -F
  10. 针对托管您要回滚的组件的每个节点重复此流程。

回滚 mTLS

如需回滚 mTLS 更新,请在所有主机上执行以下步骤:

  1. 停止 Apigee:
    apigee-all stop
  2. 停止 mTLS:
    apigee-service apigee-mtls uninstall
  3. 重新安装 mTLS:
    apigee-service apigee-mtls install
    apigee-service apigee-mtls setup -f /opt/silent.conf