私有雲 v4.18.05 的邊緣
如果您在更新至 Edge 4.18.05 時發生錯誤,可以復原導致錯誤的元件,然後再嘗試更新。
您可以將 Edge 4.18.05 復原至下列功能發布版本:
- 版本 4.18.01
- 版本 4.17.09*
- 版本 4.17.05*
* 如果想從 4.18.05 復原至 4.17.09 或 4.17.05,除了復原每個節點上的元件外,還必須復原 Postgres。如果您復原至 4.18.01 版,則不需要復原 Postgres,因為升級程序不包含 Postgres 更新。
有兩種情況會建議您執行復原作業:
- 復原至先前的功能版本。例如從 4.18.05 到 4.18.01。
- 復原至相同版本中的前一個更新版本。例如從 4.18.05.02 到 4.18.05.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 伺服器)
舉例來說,如果您在節點中安裝了管理伺服器、路由器和訊息處理器,就必須復原三個節點,才能復原其中一個。
復原至先前的功能版本
如果想從 4.18.05 復原至 4.17.09 或 4.17.05,除了復原每個節點上的元件外,還必須復原 Postgres。如果您是從 4.18.01 版復原,則不需要復原 Postgres,因為升級程序不包含 Postgres 更新。
如要復原至先前的功能版本,請在代管該元件的每個節點上執行下列操作:
-
針對您要復原的版本,下載
bootstrap.sh
檔案:- 如要復原至 4.18.01 版,請下載
bootstrap_4.18.01.sh
:curl https://software.apigee.com/bootstrap_4.18.01.sh -o /tmp/bootstrap_4.18.01.sh
- 如要復原至 4.17.09 版,請下載
bootstrap_4.17.09.sh
:curl https://software.apigee.com/bootstrap_4.17.09.sh -o /tmp/bootstrap_4.17.09.sh
- 如要復原至 4.17.05 版,請下載
bootstrap_4.17.05.sh
:curl https://software.apigee.com/bootstrap_4.17.05.sh -o /tmp/bootstrap_4.17.05.sh
- 如要復原至 4.18.01 版,請下載
- 停止元件即可復原:
- 如要復原節點上任何含有通用程式碼的元件,您必須全部停止這些元件,如以下範例所示:
/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
- 如要復原節點上的「其他」元件,請停止該元件:
/opt/apigee/apigee-service/bin/apigee-service component stop
- 如要復原節點上任何含有通用程式碼的元件,您必須全部停止這些元件,如以下範例所示:
- 如要復原「營利」功能,請將該功能從所有管理伺服器和訊息處理器節點中解除安裝:
/opt/apigee/apigee-service/bin/apigee-service edge-mint-gateway uninstall
- 解除安裝元件即可在節點上復原:
- 如要復原節點上任何含有通用程式碼的元件,您必須解除安裝
edge-gateway
元件群組,將所有元件解除安裝,如以下範例所示:/opt/apigee/apigee-service/bin/apigee-service edge-gateway uninstall
- 如要復原節點上的任何其他元件,請只解除安裝該元件,如以下範例所示:
/opt/apigee/apigee-service/bin/apigee-service component uninstall
其中 component 是元件名稱。
- 如要復原 Edge Router,除瞭解除安裝
edge-gateway
元件群組之外,您還必須刪除/opt/nginx/conf.d
檔案的內容:cd /opt/nginx/conf.d
rm -rf *
- 如要復原節點上任何含有通用程式碼的元件,您必須解除安裝
- 解除安裝
apigee-setup
4.18.05 版本:/opt/apigee/apigee-service/bin/apigee-service apigee-setup uninstall
- 安裝 4.18.01、4.17.09 或 4.17.05 版的
apigee-service
公用程式及其依附元件。以下範例會安裝apigee-service
的 4.17.09 版:sudo bash /tmp/bootstrap_4.17.09.sh apigeeuser=uName apigeepassword=pWord
其中 uName 和 pWord 是您從 Apigee 收到的使用者名稱和密碼。如果省略 pWord,系統會提示您輸入。
如果收到錯誤訊息,請確認您已下載步驟 1 中的
bootstrap.sh
檔案。 - 安裝
apigee-setup
:/opt/apigee/apigee-service/bin/apigee-service apigee-setup install
- 安裝舊版元件:
/opt/apigee/apigee-setup/bin/setup.sh -p component -f configFile
其中 component 是要安裝的元件,configFile 是舊版的設定檔。
- 如果要復原 Qpid,請清除 iptables:
sudo iptables -F
- 針對您要復原的元件的每個託管節點,重複執行這項程序。
如果想從 4.18.05 復原至 4.17.09 或 4.17.05,除了復原每個節點上的元件外,還必須復原 Postgres。如果您是從 4.18.01 版復原,則不需要復原 Postgres,因為升級程序不包含 Postgres 更新。
復原至前一個更新版本
如要將元件復原至特定版本,請在代管該元件的每個節點上執行下列操作:
- 下載特定元件版本:
/opt/apigee/apigee-service/bin/apigee-service component_version install
其中 component_version 是要安裝的元件和更新版本。例如:
/opt/apigee/apigee-service/bin/apigee-service edge-ui-4.17.09-0.0.3749 install
如果您使用的是 Apigee 線上存放區,則可以使用以下指令判斷可用的元件版本:
yum --showduplicates list comp
例如:
yum --showduplicates list edge-ui
- 請使用
apigee-setup
安裝元件:/opt/apigee/apigee-setup/bin/setup.sh -p comp -f configFile
例如:
/opt/apigee/apigee-setup/bin/setup.sh -p ui -f configFile
請注意,安裝元件時只需要指定元件名稱,而非版本。
- 針對您要復原的元件的每個託管節點,重複執行這項程序。
如果想從 4.18.05 復原至 4.17.09 或 4.17.05,除了復原每個節點上的元件外,還必須復原 Postgres。如果您是從 4.18.01 版復原,則不需要復原 Postgres,因為升級程序不包含 Postgres 更新。
復原 Postgres 9.6 更新
如果您已從 4.17.05 或 4.17.09 版升級至 4.18.05 版,則除了 Edge 元件之外,您也必須復原 Postgres 更新。
在主要待命設定中更新 Postgres 時,如何復原 Postgres 更新:
- 將新的待命節點升級為 Postgres 主要執行個體。新的 Postgres 主版本會與您先前安裝的 Edge 版本相同。
- 將舊待命節點設為新主要執行個體的待命節點。舊的待命節點版本與您先前安裝的 Edge 版本相同。
- 向數據分析和消費者群組註冊新的主要和待命節點。
復原作業完成後,就無法再使用舊的主要節點。然後,您就可以停用舊的主要節點。
- 確認新的待命 Postgres 節點正在執行:
/opt/apigee/apigee-service/bin/apigee-all status
如果 Postgres 未執行,請啟動:
/opt/apigee/apigee-service/bin/apigee-all start
- 確認舊的主要節點和舊的待命節點上的 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
- 安裝後,在舊的待命節點上啟動 Qpid:
/opt/apigee/apigee-service/bin/apigee-service edge-qpid-server start
- 將新的待命節點升級為 Postgres 主要執行個體:
- 將新的待命節點升級為新的主要執行個體:
apigee-service apigee-postgresql promote-standby-to-master new_standby_IP
如果出現提示訊息,請輸入「apigee」使用者的 Postgres 密碼,預設為「postgres」。
- 編輯您用來安裝目前 Edge 版本的設定檔,指定以下內容:
# IP address of the new master: PG_MASTER=new_standby_IP # IP address of the old standby node PG_STANDBY=old_standby_IP
- 設定新的主要執行個體:
/opt/apigee/apigee-service/bin/apigee-service apigee-postgresql setup-replication-on-master -f configFile
- 將新的待命節點升級為新的主要執行個體:
- 重新建立舊的待命節點:
- 編輯您用來安裝目前 Edge 版本的設定檔,指定以下內容:
# IP address of the new master: PG_MASTER=new_standby_IP # IP address of the old standby node PG_STANDBY=old_standby_IP
- 移除舊待命節點上的資料目錄:
cd /opt/apigee/data/apigee-postgresql/pgdata > rm -rf *
- 將舊的待命節點重新設定為新主要執行個體的待命節點:
/opt/apigee/apigee-service/bin/apigee-service apigee-postgresql setup-replication-on-standby -f configFile
- 確認 Postgres 在舊的待命節點上執行:
/opt/apigee/apigee-service/bin/apigee-all status
如果服務尚未執行,請啟動:
/opt/apigee/apigee-service/bin/apigee-service edge-postgres-server start
- 編輯您用來安裝目前 Edge 版本的設定檔,指定以下內容:
- 查看新主要執行個體的
/opt/apigee/apigee-postgresql/conf/pg_hba.conf
檔案,確認是否已新增待命節點。 - 在管理伺服器上執行下列指令,查看目前的數據分析和消費者群組資訊:
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" : { } }
- 在舊主要節點執行下列
curl
指令,取得舊主要執行個體的 UUID 位址:curl -u sysAdminEmail:password http://node_IP:8084/v1/servers/self
在輸出的結尾,您會看見節點的 UUID,格式如下:
"type" : [ "postgres-server" ], "uUID" : "599e8ebf-5d69-4ae4-aa71-154970a8ec75"
- 重複執行上一個步驟,取得舊待命節點和新主要執行個體的 IP 位址。
- 從消費者群組中移除舊的主要和待命節點:
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
屬性現在應為空白屬性。 - 從分析群組中移除舊的主要和待命節點:
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
屬性現在應為空白。 - 註冊新的 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
- 驗證數據分析群組:
curl -u sysAdminEmail:password http://ms_IP:8080/v1/analytics/groups/ax
您應該會看到數據分析群組和消費者群組中列出的新主要和待命節點的 UUID。
- 重新啟動 Edge Management Server:
/opt/apigee/apigee-service/bin/apigee-service edge-management-server restart
- 重新啟動所有 Qpid 伺服器:
/opt/apigee/apigee-service/bin/apigee-service edge-qpid-server restart
- 重新啟動所有 Postgres 伺服器:
/opt/apigee/apigee-service/bin/apigee-service edge-postgres-server restart
- 在兩個伺服器上發出下列指令碼,驗證複製狀態。系統應在兩個伺服器上顯示相同的結果,以確保成功複製:
在新主要執行個體上,執行:
/opt/apigee/apigee-service/bin/apigee-service apigee-postgresql postgres-check-master
並驗證其是否為主頁檔案。在舊的待命節點上:
/opt/apigee/apigee-service/bin/apigee-service apigee-postgresql postgres-check-standby
確認這是待命。
- 提出多個 API 要求後,重複上一個步驟,確保節點為同步狀態。
- 按照更新 Apigee Edge 4.16.01/4.16.05 至 4.17.09 中的程序停用舊的 Postgres 主要執行個體。
或者,您也可以從舊的主要執行個體解除安裝 Qpid,並在新的主要節點上安裝 Qpid。解除安裝 Qpid 後,即可停用舊的主要節點。
將 Qpid 從舊的主要執行個體解除安裝,然後在新的主要執行個體上安裝 Qpid
如何將 Qpid 從舊的主要執行個體解除安裝,並在新的主要執行個體上安裝:
- 對所有訊息處理器執行下列指令,禁止訊息處理器存取舊主要執行個體 5672 的 Qpid 通訊埠 5672 存取權:
iptables -A OUTPUT -p tcp -d 10.233.147.20 --dport 5672 -j DROP
- 執行下列指令,確保 Qpid 訊息佇列沒有任何內容。Qpid 處理完畢後,您才能解除安裝 Qpid:
qpid-stat -q
這個指令會顯示包含
msg, msgIn, and msgOut
計數的資料表。系統會在msg=0
和msgIn=msgOut
時處理所有訊息。 - 在舊主要執行個體上執行下列指令,判定舊主要執行個體上的 Qpid 伺服器的 UUID。請儲存這項資訊,以便在後續程序中使用:
curl -u sysAdminEmail:password http://node_IP::8083/v1/servers/self
- 停止舊主要執行個體上的 Qpid:
/opt/apigee/apigee-service/bin/apigee-service edge-qpid-server stop
/opt/apigee/apigee-service/bin/apigee-service apigee-qpidd stop
- 解除安裝 Qpid 伺服器:
/opt/apigee/apigee-service/bin/apigee-service edge-qpid-server uninstall
/opt/apigee/apigee-service/bin/apigee-service apigee-qpidd uninstall
- 將舊的 Qpid 伺服器從數據分析和消費者群組中移除:
curl -u sysAdminEmail:password -X DELETE -H "Content-Type: application/json" -d '' \ "http://ms_IP:8080/v1/analytics/groups/ax/axgroup-001/consumer-groups/consumer-group-001/consumers/qpid_UUID" -v
curl -u sysAdminEmail:password -X DELETE \ "http://ms_IP:8080/v1/analytics/groups/ax/axgroup-001/servers?uuid=qpid_UUID&type=qpid-server" -v
- 從 Zookeeper 中移除舊的 Qpid 伺服器:
curl -u sysAdminEmail:password -X DELETE \ http://ms_IP:8080/v1/servers/qpid_UUID
- 在新的主要執行個體上安裝 Qpid:
/opt/apigee/apigee-setup/bin/setup.sh -p qs -f configFile
- 在新主要執行個體上執行下列指令,以判斷新主要執行個體上的 Qpid 伺服器的 UUID。請儲存這項資訊,以便在後續程序中使用:
curl -u sysAdminEmail:password http://node_IP::8083/v1/servers/self
- 將數據分析和消費者群組註冊新的 Qpid 伺服器:
curl -u sysAdminEmail:password -X POST -H "Content-Type: application/json" -d '' \ "http://ms_IP:8080/v1/analytics/groups/ax/axgroup-001/servers?uuid=qpid_UUID&type=qpid-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/consumers?uuid=qpid_UUID" -v
- 重新啟動所有訊息處理器:
/opt/apigee/apigee-service/bin/apigee-service edge-message-processor restart
- 請在新的 Qpid 伺服器上執行下列指令,以檢查佇列是否已建立:
qpid-stat -q
確認 Qpid 伺服器處理訊息時,您看到
msg
、msgIn
和msgOut
已更新。
如果在復原期間遇到問題,請與 Apigee Edge 支援團隊聯絡。