復原 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。
  • 復原 UI
  • 復原 LDAP。
  • 復原管理伺服器。
  • 復原路由器和訊息處理器。

舉例來說,假設您已將所有路由器和訊息處理器、所有管理伺服器、LDAP 和部分 UI 節點從 4.53.00 (或 4.53.01) 版升級至 4.54.00 版,並希望復原。在這種情況下,您會:

  • 復原升級的 UI 節點
  • 復原 LDAP 節點
  • 逐一復原管理伺服器節點
  • 逐一復原所有 RMP

誰可以執行回溯

執行復原作業的使用者應與原先更新 Edge 的使用者相同,或以 root 身分執行的使用者。

根據預設,Edge 元件會以「apigee」使用者身分執行。在某些情況下,您可能會以不同使用者身分執行 Edge 元件。舉例來說,如果路由器必須存取特殊權限通訊埠 (例如低於 1000 的通訊埠),則必須以 root 身分或具備這些通訊埠存取權的使用者身分執行路由器。或者,您可能會以一個使用者身分執行一個元件,並以另一個使用者身分執行另一個元件。

復原 Cassandra

在特定節點上執行 Cassandra 的主要升級作業時,Cassandra 會修改儲存在該節點上的資料結構定義。因此無法直接就地復原。

復原情境

下表彙整可用的復原策略:

情境 復原策略
單一 DC,部分 Cassandra 節點已升級 使用備用選項
多個 DC,其中一個 DC 的部分節點已升級 從現有 DC 重新建構
多個 DC,部分 DC 中的所有 Cassandra 節點已升級 從現有 DC 重新建構
多個 DC,正在升級最後一個 DC 的 Cassandra 節點 請嘗試完成升級。如果不可行,請使用備份還原 1 個 DC。從回溯的 DC 重建其餘 DC。

一般注意事項

考慮回溯時,請注意下列事項:

  • 在 Cassandra 升級期間復原 Cassandra:如果在 Cassandra 升級期間遇到問題,建議您考慮復原。請根據您在升級程序中的狀態,按照本文中的復原策略操作。
  • 使用備份還原:從 Cassandra 5.0.X 建立的備份與 Cassandra 4.0.X 的備份不相容。如要使用備份還原功能復原 Cassandra,您必須先備份 Cassandra 4.0.X,再嘗試升級。
還原 Cassandra 應視為最後手段。

使用重建作業復原 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 節點時,將所有執行階段 Proxy 流量和管理流量從這個資料中心轉移。 在節點上執行 nodetool ring 指令時,請確認所有 Cassandra 節點都處於 UN (Up/Normal) 狀態。如果特定節點停止運作,請先排解問題並重新啟動這些節點,再繼續操作。

    請參考以下範例:

    /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,瞭解整個叢集的目前狀態。舉例來說,以下範例顯示 2 個資料中心叢集的執行個體,其中所有 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 it.
    # 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 的驗證,然後開始將 Proxy 和管理 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 在節點上執行,請停止 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 檔案。如要復原至 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 位址的要求 DROP 至通訊埠 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 安裝版本相同。
  • 向 Analytics 和消費者群組註冊新的主要和待命節點。

復原完成後,就不再需要舊的主節點。接著,您就可以停用舊的主節點。

事前準備

將 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 欄位中傳回 Analytics 群組名稱,並在 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. 向 Analytics 和消費者群組註冊新的 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. 驗證 Analytics 群組:
    curl -u sysAdminEmail:password http://ms_IP:8080/v1/analytics/groups/ax

    您應該會在數據分析群組和消費者群組中,看到新主要和待命節點的 UUID。

  15. 重新啟動 Edge 管理伺服器:
    /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 將傳統版 UI (edge-ui) 替換為新版 Edge UI (edge-management-ui)。由於 UI 元件在 4.54.00 版中有所變更,因此如要復原至 4.53.00 或 4.53.01 版,您必須解除安裝 edge-management-ui,並重新安裝先前的 UI 設定檔:

  • 傳統使用者介面 (edge-ui):重新安裝ui設定檔。
  • 新版 Edge UI (edge-ui 和 edge-management-ui):在各自的節點中重新安裝 ui 和 ue 設定檔。

如要在節點上還原 UI,請按照下列步驟操作:

  1. 停止並解除安裝 4.54.00 新版 Edge UI,然後安裝舊版以復原:
    1. 停止並解除安裝 4.54.00 新版 Edge UI (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. 執行 Apigee 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 UI 設定:
    • 如果您已備份 4.53.00 或 4.53.01 安裝作業的無訊息設定檔,請使用該備份檔案進行復原程序。否則,請在 4.54.00 靜音設定檔中,還原或取消註解在升級期間移除或註解排除的 4.53.00 或 4.53.01 UI 屬性。詳情請參閱「UI 升級」一節。
    • 如果升級期間刪除了 /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. 重新安裝及設定舊版 UI:
    • 復原為傳統使用者介面 (edge-ui):
      1. 安裝並設定傳統版 UI (如果是基本驗證,則不需要額外步驟):
        /opt/apigee/apigee-setup/bin/setup.sh -p ui -f configFile
      2. 如果已啟用 SSO,請在傳統版 UI 上設定 SSO (請先確認 apigee-sso 正在執行):
        /opt/apigee/apigee-service/bin/apigee-service edge-ui configure-sso -f configFile
    • 復原至 4.53.00 或 4.53.01 新版 Edge UI (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. 如果已啟用 SSO,請在兩個 UI 元件上設定 SSO (請務必先執行 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. 確認復原後的 UI 狀態和版本:
    • 傳統版 UI (edge-ui):
      /opt/apigee/apigee-service/bin/apigee-service edge-ui status
      /opt/apigee/apigee-service/bin/apigee-service edge-ui version
    • 新版 Edge UI (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 叢集還原至一致狀態。無論是單一伺服器、主動-主動或主動-被動情境,都適用此程序。

事前準備

  • 備份不相容:使用升級前從 OpenLDAP 2.4.46 (Edge for Private Cloud 4.53.00) 或 Symas OpenLDAP 2.6.7 (Edge for Private Cloud 4.53.01) 取得的備份,該備份是在嘗試升級前使用 apigee-service apigee-openldap backup 取得。升級後進行的備份作業不相容,因此無法使用。
  • Management API 停機:LDAP 復原期間,Management API 將無法使用,這可能會影響管理工作。請先關閉所有 edge-management-server 和 edge-ui 執行個體,再復原 LDAP。
  • 資料遺失風險:如果沒有相容的有效備份檔,繼續操作可能會導致資料永久遺失。
  • 有效備份:必須有升級前的有效 LDAP 備份。
  • 備份 silent.conf 檔案:保留前一版和目前版本的 silent.conf 檔案備份,避免在升級和復原程序中混淆設定。
  • 復原順序:先完成 Cassandra、ZooKeeper、Qpid、PostgreSQL、apigee-sso 和 Edge UI 的復原程序,再復原 OpenLDAP。

復原程序

  1. 關閉管理伺服器和 UI:請先關閉所有 edge-management-server 和 edge-ui 執行個體,再復原 LDAP:
    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. 如要復原 Monetization,請從所有管理伺服器和訊息處理器節點解除安裝:
    /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. 解除安裝 apigee-setup 4.54.00 版:
    /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