復原 Apigee Edge 4.51.00

如果您在更新至 Edge 4.51.00 時發生錯誤,可以復原導致錯誤的元件,然後再嘗試更新。

您可以將 Edge 4.51.00 復原至下列功能發布版本:

  • 版本 4.50.00
  • 版本 4.19.06

有兩種情況會建議您執行復原作業:

  1. 復原至先前的功能版本。例如從 4.51.00 到 4.50.00。
  2. 復原至相同版本中的前一個更新版本。例如從 4.50.00.02 到 4.50.00.01。

詳情請參閱 Apigee Edge 發布程序

誰可以執行復原作業

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

根據預設,Edge 元件會以使用者「apigee」的形式執行。在某些情況下,您可能會以不同使用者的身分執行 Edge 元件。舉例來說,如果路由器需要存取特殊權限通訊埠 (例如 1000 以下的通訊埠),您就必須以根層級或有權存取這些通訊埠的使用者的身分執行路由器。或者,您也可以以單一使用者的身分執行某個元件,並以其他使用者的身分執行另一個元件。

含有常用程式碼的元件

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

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

舉例來說,如果您在節點中安裝了管理伺服器、路由器和訊息處理器,就必須復原三個節點,才能復原其中一個。

復原至先前的功能版本

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

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

    • 如要復原至 4.50.00 版,請下載 bootstrap_4.50.00.sh
      curl https://software.apigee.com/bootstrap_4.50.00.sh -o /tmp/bootstrap_4.50.00.sh 
    • 如要復原至 4.19.06 版,請下載 bootstrap_4.19.06.sh
      curl https://software.apigee.com/bootstrap_4.19.01.sh -o /tmp/bootstrap_4.19.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 元件群組,將所有元件解除安裝,如以下範例所示:
      /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.51.00 版本:
    /opt/apigee/apigee-service/bin/apigee-service apigee-setup uninstall
  6. 安裝 apigee-service 公用程式的 4.19.06 或 4.50.00 版本及其依附元件。以下範例會安裝 apigee-service 的 4.50.00 版:
    sudo bash /tmp/bootstrap_4.50.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.18.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.19.06 或 4.50.00 版升級至 4.51.00 版,則除了 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. 註冊新的 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. 按照更新 Apigee Edge 4.16.01/4.16.05 至 4.17.09 中的程序停用舊的 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