將 Apigee Edge 4.53.01 回復原狀

如果在更新至 Edge 4.53.01 時發生錯誤,可以回溯導致錯誤的元件,然後再次嘗試更新。

您可以將 Edge 4.53.01 復原至下列任一主要版本:

  • 4.53.00 版
  • 版本 4.52.02

如要復原版本,您可能需要復原所有升級的元件。此外,根據您開始使用的版本,您可能需要先採取特殊步驟,才能復原特定軟體元件。下表列出各種軟體元件,在回溯期間可能需要特殊步驟:

復原至版本 軟體特別注意事項
4.53.00 ZookeeperPostgresLDAP
4.52.02 ZookeeperCassandraPostgresLDAP

以下是您可能需要執行回溯的情境:

復原為先前的重大或次要版本。例如從 4.53.01 降級至 4.53.00。

詳情請參閱「Apigee Edge 發布程序」。

復原順序

復原元件時,應按照升級時的相反順序進行,但管理伺服器應在 Cassandra 之後復原。私有雲 4.53.01 的一般回溯順序如下:

  1. 回溯 Qpid、其他與分析相關的元件和 Postgres。
  2. 復原路由器和訊息處理器
  3. 回溯 Cassandra、Zookeeper
  4. 復原管理伺服器
  5. 復原 LDAP

舉例來說,假設您已將整個 Cassandra 叢集、所有管理伺服器和幾個 RMP 從 4.52.02 版升級至 4.53.01 版,現在想還原。在這種情況下,你會:

  • 逐一回溯所有 RMP
  • 使用備份還原整個 Cassandra 叢集
  • 逐一回溯 Edge Management 伺服器節點

誰可以執行回溯

執行回溯的使用者,應與當初更新 Edge 的使用者相同,或是以根層級身分執行的使用者。

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

具有通用程式碼的元件

下列 Edge 元件共用通用程式碼。因此,如要將節點上的任何一個元件回復原狀,必須將該節點上的所有元件回復原狀。

  • edge-management-server (管理伺服器)
  • edge-message-processor (訊息處理器)
  • edge-router (路由器)
  • edge-postgres-server (Postgres 伺服器)
  • edge-qpid-server (Qpid 伺服器)

舉例來說,如果您在節點上安裝了管理伺服器、路由器和訊息處理器,如要回溯其中任何一個,就必須回溯全部三個。

回溯 Cassandra

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

復原情境

Cassandra 4.0.X 適用於 Private Cloud 4.53.01 版 Edge,且與 Private Cloud 4.52.02 版的其他元件相容。

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

情境 復原策略
單一 DC,部分 Cassandra 節點已升級 使用備份
單一 DC,所有 Cassandra 節點都已升級 請勿復原 Cassandra。其他元件可以回溯。
單一 DC,所有節點 (Cassandra 和其他節點) 皆已升級 請勿復原 Cassandra。其他元件可以回溯。
多個 DC,其中一個 DC 的部分節點已升級 從現有 DC 重新建構
多個 DC,某些 DC 中的所有 Cassandra 節點都已升級 從現有 DC 重新建構
多個 DC,正在升級最後一個 DC 的 Cassandra 節點 請嘗試完成升級。如果無法執行這項操作,請使用備份還原 1 個 DC。從復原的 DC 重建其餘 DC
多個 DC,所有 Cassandra 節點都已升級 請勿復原 Cassandra。其他元件可以回溯。
多個 DC,所有節點 (Cassandra 和其他節點) 都已升級 請勿復原 Cassandra。其他元件可以回溯。

一般注意事項

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

  • 執行階段或管理元件的回溯:如要將 edge-management-server、edge-message-processor 或任何非 Cassandra 元件回溯至 Private Cloud 4.52.02 版,建議您不要回溯 Cassandra。Private Cloud 4.53.00 隨附的 Cassandra 與 Edge for Private Cloud 4.52.02 的所有非 Cassandra 元件相容。您可以使用這裡列出的方法,將非 Cassandra 元件回復原狀,而 Cassandra 仍維持在 4.0.13 版。
  • 在整個 Cassandra 叢集升級至 4.0.X 後進行回溯:如果整個 Cassandra 叢集在升級至 Private Cloud 4.53.00 版時升級至 4.0.X 版,建議您繼續使用這個叢集設定,不要回溯 Cassandra。Private Cloud 4.52.02 版的邊緣管理伺服器、邊緣訊息處理器、邊緣路由器等元件,與 Cassandra 4.0.X 版相容。
  • 在 Cassandra 升級期間回溯 Cassandra:如果在 Cassandra 升級期間遇到問題,不妨考慮回溯。您可以根據升級過程中的狀態,按照本文列出的復原策略操作。
  • 使用備份還原:從 Cassandra 4.0.X 建立的備份與 Cassandra 3.11.X 的備份不相容。如要使用備份還原功能回溯 Cassandra,您必須先備份 Cassandra 3.11.X,再嘗試升級。

使用重建作業回溯 Cassandra

必要條件

  • 您在多個資料中心運作 Edge for Private Cloud 4.52.02 叢集。
  • 您正在將 Cassandra 從 3.11.X 升級至 4.0.X,但升級期間發生問題。
  • 叢集中至少有一個功能齊全的資料中心,仍執行舊版 Cassandra (Cassandra 3.11.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:
        4.0.13: [DC-1-IP1:7000, DC-1-IP2:7000, DC-1-IP3:7000]
        3.11.16: [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 4 版的第一個種子節點。別再說了。
    # 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.52.02 的啟動程序檔案。
  5. # Download bootstrap of 4.52.02
    curl https://software.apigee.com/bootstrap_4.52.02.sh -o /tmp/bootstrap_4.52.02.sh -u uName:pWord
    
    # Execute bootstrap of 4.52.02
    sudo bash /tmp/bootstrap_4.52.02.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 3.11.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 從 3.11.X 升級至 4.0.X,但升級期間發生問題。
  2. 您有要復原節點的備份。備份是在嘗試從 3.11.X 升級至 4.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.52.02 的啟動程序檔案:
    • # Download bootstrap for 4.52.02
      curl https://software.apigee.com/bootstrap_4.52.02.sh -o /tmp/bootstrap_4.52.02.sh -u uName:pWord
      
      # Execute bootstrap for 4.52.02
      sudo bash /tmp/bootstrap_4.52.02.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 3.11.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-IP1DC-1-IP2DC-2-IP1DC-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 3.8.4 更新

復原

如需復原:

  1. 請先對觀察者和追蹤者執行回溯步驟。
  2. 下載並執行要復原的版本 (4.52.02 或 4.53.00) 的啟動程序。 程序可能會因節點是否具備外部網際網路連線,或您是否要進行離線安裝而異。
  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. 所有節點復原後,請確認叢集健康狀態,並確保叢集中有領導者節點。

還原備份

請參閱「從備份還原」。 請注意,從 Edge for Private Cloud 4.52.02 或 4.53.00 等舊版建立的 Zookeeper 備份,應與 Edge for Private Cloud 4.53.01 中的 Zookeeper 版本相容。

復原 Postgres 17 更新

如果您從 4.52.02 或 4.53.00 版升級至 4.53.01 版,除了 Edge 元件,您也必須回溯 Postgres 更新。

在主要/待機設定中更新 Postgres 時,如要復原 Postgres 更新,請按照下列步驟操作:

  • 將新的待命節點升級為 Postgres 主節點。新的 Postgres 主要執行個體版本會與先前的 Edge 安裝版本相同。
  • 將舊的待命節點設定為新主節點的待命節點。舊的待命節點會與先前的 Edge 安裝版本相同。
  • 向 Analytics 和消費者群組註冊新的主要和待命節點。

完成回溯後,舊的主節點就不再需要。然後停用舊的主節點。

事前準備

將 Postgres 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
    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. 在管理伺服器上執行下列指令,查看目前的 Analytics 和消費者群組資訊:
    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-001consumer-group-001 是分析和消費者群組的預設名稱。masterUUID,standbyUUID的順序與您查看目前分析和消費者群組資訊時的順序相同。您可能必須將這些欄位指定為 standbyUUID,masterUUID

    consumer-groupsdatastores 屬性現在應該為空白。

  12. 從 Analytics 群組中移除舊的主節點和待命節點:
    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 和 Consumer 群組註冊新的 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 節點」一文中的程序,停用舊的 Postgres 主要執行個體。

    或者,您也可以從舊主機解除安裝 Qpid,然後在新主機節點上安裝 Qpid。解除安裝 Qpid 後,即可停用舊主節點。

復原 LDAP 2.6 更新

本節提供完整逐步指南,說明如何將 LDAP 安裝作業還原至先前的 LDAP 版本。您必須對整個 LDAP 叢集執行回溯作業,且只能使用有效的升級前 LDAP 備份。

主要目標是從已知的良好備份還原整個 LDAP 叢集,使其回到一致狀態。無論是單一伺服器、雙主動或主動/被動,都適用於這個程序。

必要條件和注意事項

  • 備份不相容:使用舊版 2.4 LDAP 的備份檔,該版本與 Edge for Private Cloud 4.52.02 或 4.53.00 搭配使用。備份作業必須在嘗試升級前完成。升級後建立的備份不相容,無法使用。
  • 管理 API 停機:LDAP 回復期間,管理 API 將無法使用,這可能會影響管理工作。請務必先關閉所有 edge-management-server 和 edge-ui,再繼續執行 LDAP 回復作業。
  • 資料遺失風險:如果沒有相容的有效備份檔,繼續操作可能會導致資料遺失,且無法復原。
  • 有效備份:必須提供升級前有效的 LDAP 備份。

復原程序

  1. 請務必先關閉所有邊緣管理伺服器和邊緣使用者介面,再繼續進行 LDAP 升級。
    apigee-service edge-management-server stop
    apigee-service edge-ui stop
  2. 備份現有 LDAP 資料 (停止 LDAP 服務前)

    從所有 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
    • 安裝舊版 LDAP:
      /opt/apigee/apigee-setup/bin/setup.sh -p ld -f /opt/silent.conf
    • 驗證 LDAP 版本:
      source ~/.bash_profile
      ldapsearch -VV
      
      #Expected output:
      ldapsearch: @(#) $OpenLDAP: ldapsearch 2.4.46
    • 針對每個 LDAP 節點,一次一個,重複上述步驟
  5. 清除殘餘資料

    在所有 LDAP 伺服器上,一次停止一個新安裝的服務,並清除其資料目錄,準備從備份還原。

    apigee-service apigee-openldap stop
    rm -rf /opt/apigee/data/apigee-openldap/*
  6. 還原 LDAP 資料

    如果是單一伺服器設定,可以直接前往步驟 5b。如要設定多部伺服器,請繼續執行步驟 5a。

    1. 找出有效的 LDAP 伺服器

      還原 LDAP 資料前,請先執行下列指令,找出作用中的伺服器 (供應商)。

      grep -i '^olcSyncrepl:' /opt/apigee/data/apigee-openldap/slapd.d/cn=config/olcDatabase*\ldif
      
      * **Note**:
      * If this command returns output, the server is a passive server. 
      * If it returns no output, the server is the active server.
    2. 還原 LDAP 資料 (請務必先在所有伺服器上完成步驟 4,再還原資料)。
      • 在單一作用中的 LDAP 伺服器 (步驟 5a 中判斷的伺服器) 上還原備份。
        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 伺服器上執行驗證指令。所有伺服器的記錄計數應相同,且必須與您在步驟 1 中擷取的計數相符。
      # 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
    • 確認資料正確無誤且一致後,LDAP 回復作業即完成。現在可以按照貴機構的標準升級程序,啟動 edge-management-serveredge-ui 和任何其他相依元件。

復原至先前的重大或次要版本

如要復原到先前的主要或次要版本,請在每個代管元件的節點上執行下列操作:

  1. 下載要還原版本的 bootstrap.sh 檔案:

    • 如要復原至 4.52.02 版,請下載bootstrap_4.52.02.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,請從所有管理伺服器和 Message Processor 節點解除安裝:
    /opt/apigee/apigee-service/bin/apigee-service edge-mint-gateway uninstall
  4. 解除安裝元件,在節點上還原:
    1. 如要將節點上的任何共用程式碼元件回復原狀,必須解除安裝 edge-gatewayapigee-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.26.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.53.01 版:
    /opt/apigee/apigee-service/bin/apigee-service apigee-setup uninstall
  6. 安裝 4.52.02 版的 apigee-service 公用程式及其依附元件。以下範例會安裝 apigee-service 的 4.52.02 版:
    sudo bash /tmp/bootstrap_4.52.02.sh apigeeuser=uName apigeepassword=pWord

    其中 uNamepWord 是您從 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