復原 Apigee Edge 4.52.01

如果您在更新至 Edge 4.52.01 時發生錯誤,可以復原造成錯誤的元件,然後再次嘗試更新。

您可以將 Edge 4.52.01 復原至下列主要發布版本:

  • 版本 4.52.00
  • 版本 4.51.00

在下列情況中,您可能會想執行復原作業:

  1. 復原至先前的主要或次要版本。例如從 4.52.01 到 4.52.00。
  2. 復原至同一版本中先前的修補程式版本。例如從 4.52.00.02 到 4.52.00.01。

詳情請參閱 Apigee Edge 發布程序

誰可以執行復原作業

執行復原作業的使用者,應與最初更新 Edge 的使用者或以根層級執行的使用者相同。

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

含有通用程式碼的元件

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

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

舉例來說,如果您在節點中安裝了 Management Server、路由器和訊息處理器,要復原其中一個節點,就必須復原這三者。

復原至先前的主要版本或次要版本

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

  1. 針對您要復原的版本,下載 bootstrap.sh 檔案:

    • 如要復原至 4.51.00 版,請下載 bootstrap_4.51.00.sh
      curl https://software.apigee.com/bootstrap_4.51.00.sh -o /tmp/bootstrap_4.51.00.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 元件群組來解除安裝所有項目,如以下範例所示:
      /opt/apigee/apigee-service/bin/apigee-service edge-gateway uninstall
    2. 如要復原節點上的任何其他元件,只要解除安裝該元件即可,如以下範例所示:
      /opt/apigee/apigee-service/bin/apigee-service component uninstall

      其中 component 是元件名稱。

    3. 如要復原 Edge Router,除瞭解除安裝 edge-gateway 元件群組外,還必須刪除 /opt/nginx/conf.d 檔案的內容:
      cd /opt/nginx/conf.d
      rm -rf *
  5. 解除安裝 apigee-setup 的 4.52.01 版本:
    /opt/apigee/apigee-service/bin/apigee-service apigee-setup uninstall
  6. 安裝 4.51.00 版本的 apigee-service 公用程式及其依附元件。以下範例會安裝 4.51.00 版的 apigee-service
    sudo bash /tmp/bootstrap_4.51.00.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. 針對您要復原的元件,針對每個代管元件的節點重複這項程序。

復原至先前的修補程式版本

如要將元件復原至特定修補程式版本,請在代管該元件的每個節點上執行下列步驟:

  1. 下載特定元件版本:
    /opt/apigee/apigee-service/bin/apigee-service component_version install

    其中 component_version 是要安裝的元件和修補程式版本。例如:

    /opt/apigee/apigee-service/bin/apigee-service edge-ui-4.51.05-0.0.3749 install

    如果您使用的是 Apigee 線上存放區,可以使用下列指令確認可用的元件版本:

    yum --showduplicates list comp

    例如:

    yum --showduplicates list edge-ui
  2. 使用 apigee-setup 安裝元件:
    /opt/apigee/apigee-setup/bin/setup.sh -p comp -f configFile

    例如:

    /opt/apigee/apigee-setup/bin/setup.sh -p ui -f configFile

    請注意,安裝時只能指定元件名稱,而不是版本。

  3. 針對您要復原的元件,針對每個代管元件的節點重複這項程序。

復原 Postgres 10.17 更新

如果您是從 4.50.00 或 4.51.00 版升級至 4.52.01,除了 Edge 元件外,也必須復原 Postgres 更新。

在主待命設定中更新 Postgres 時,如何復原 Postgres 更新:

  • 將新的待命節點升級為 Postgres 主要執行個體。新的 Postgres 主版本會與之前安裝的 Edge 相同。
  • 將舊待命節點設為新主要執行個體的待命節點。舊的待命節點版本會與先前安裝的 Edge 版本相同。
  • 透過數據分析和消費性群組註冊新的主要節點和待命節點。

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

  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 new_standby_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. 在舊的待命節點上下載並執行舊版 Bootstrap (適用於要復原的 Apigee 版本)。具體步驟可能會因裝置安裝方式 (網際網路或離線安裝) 而異。如果您執行舊版 Apigee Bootstrap,系統會使用舊版 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-001consumer-group-001 是數據分析和消費者群組的預設名稱。masterUUID,standbyUUID 的順序與您在上述目前數據分析和消費者群組資訊中看到的順序相同。您可能必須將其指定為 standbyUUID,masterUUID

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

  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. 透過數據分析和消費者群組註冊新的程式輔助保證主要節點和待命節點:
    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 節點」一文中的程序,停用舊的 Postgres 主要執行個體。

    您也可以從舊主要執行個體解除安裝 Qpid,並在新的主要節點上安裝 Qpid。解除安裝 Qpid 後,您可以停用舊的主要節點。

復原 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