降級 OpenResty Edge
注意
如升級失敗,可按照以下步驟進行回滾。在執行操作前,請務必與 OpenResty Inc. 的技術支援人員約定具體時間。1. 前期準備
請根據您的安裝方式,選擇相應的準備步驟:
線上安裝
直接下載 openresty-edge-installer.sh
:
curl -O https://openresty.com/client/oredge/openresty-edge-installer.sh
Bundle 包安裝
- 從下載中心獲取
openresty-edge-bundle-VERSION.tar.gz
- 將檔案上傳至目標伺服器
- 解壓檔案:
tar -xvf openresty-edge-bundle-VERSION.tar.gz
cd openresty-edge-bundle-VERSION
2. 降級 Edge Admin
執行安裝指令碼
sudo /bin/bash openresty-edge-installer.sh
選擇
Downgrade
操作[1] Install [2] Upgrade [3] Downgrade [4] Uninstall [5] Self Check [6] Get Default Info What would you like to do? 3 You chose: Downgrade.
選擇降級元件
Edge Admin
[1] Edge Admin [2] Edge Admin Database [3] Rebuild [4] Edge Node [5] Edge Log Server [6] Edge Log Server Database Which component would you like to downgrade? 1 You chose: Edge Admin.
輸入升級時生成的歷史記錄路徑:
Please enter the historical upgrade directory: /root/oredge-history/2024-07-01-02-03-04
輸入舊版本的 bundle 包路徑(僅適用於 bundle 包安裝方式):
Please enter the old bundle directory: /root/openresty-edge-bundle-VERSION
此步驟用於定位舊版本 OpenResty Edge 的 bundle 包位置。
成功降級後,將顯示如下提示:
Great! Downgrade openresty-edge-admin successfully."
2. 降級 Edge Admin 資料庫
操作步驟類似,但降級元件選擇
Edge Admin DB
[1] Edge Admin [2] Edge Admin Database [3] Rebuild [4] Edge Node [5] Edge Log Server [6] Edge Log Server Database Which component would you like to downgrade? 2 You chose: Edge Admin DB.
輸入當前版本號(僅適用於線上安裝方式)
Which version are you currently on? (like 24.3) 24.3
此版本號用於下載相應的資料庫降級指令碼。
成功降級後,將顯示如下提示:
Great! update admin database successfully.
3. 重新編譯
操作步驟類似,但降級元件選擇
Rebuild
[1] Edge Admin [2] Edge Admin Database [3] Rebuild [4] Edge Node [5] Edge Log Server [6] Edge Log Server Database Which component would you like to downgrade? 3 You chose: Rebuild.
首先重新編譯幾個流量較小的非泛域名 HTTP 應用,然後編譯幾個大流量的非泛域名 HTTP 應用
Do you want to rebuild one application for test? [Y/N]: y Please input the application id: 1 rebuild application 1
按照提示繼續進行編譯
Do you want to rebuild gateway? [Y/N]: y rebuild gateway recompiled gateway successfully Do you want to rebuild global-action? [Y/N]: y rebuild global-action recompile global action successfully Do you want to rebuild global? [Y/N]: y rebuild global recompile global successfully Do you want to rebuild upgrade config? [Y/N]: y rebuild upgrade config recompile upgrade configurations successfully Do you want to rebuild all wilecard apps? [Y/N]: y rebuild all wilecard apps Do you want to rebuild all apps? [Y/N]: y Do you want to compile concurrently? [Y/N]: n rebuild all apps Do you want to rebuild all http_proxy apps? [Y/N]: y rebuild all http_proxy apps Do you want to rebuild all socks5_apps? [Y/N]: y rebuild all sock5_proxy apps Do you want to rebuild waf? [Y/N]: y rebuild waf recompiled all of the WAF rule sets successfully. Do you want to rebuild dns? [Y/N]: y rebuild dns recompile dns successfully. rebuild done!
如果所有業務都正常工作,則升級完成!
若 HTTP/HTTPS 應用數量眾多,此步驟的編譯時間可能較長:
Do you want to rebuild all apps? [Y/N]: y
此時,可選擇併發編譯,將啟動 4 個程序同時編譯:
Do you want to compile concurrently? [Y/N]: y
如需進一步提速,可修改安裝器以指定更高的併發數(不超過 8),例如:
sudo /bin/bash utils/parallel-recompile.sh 8
4. 降級 Edge Node
通常,完成上述操作後,您的服務應該已恢復正常,後續步驟可以省略。這是因為新版本的 Edge Node 通常相容舊版本的 Edge Admin。
4.1 遷移流量(可選)
為減少對業務的影響,建議在降級 Edge Node 節點前,將該節點上的流量轉移到其他未升級的 Edge Node 上。 雖然此步驟為可選,但強烈建議對最初升級的少數 Edge Node 執行此操作:
- 遷移流量
- 升級
- 驗證
確認無誤後,再升級剩餘的 Edge Node。升級過程中請密切關注錯誤日誌。
如果使用 OpenResty Edge 的 DNS 控制流量,請按以下步驟將即將升級的 Edge Node 節點下線:
- 登入 OpenResty Edge 控制檯
- 進入【閘道器叢集】頁面
- 對節點所在叢集進行【編輯】
- 將節點【狀態】修改為【關閉 DNS,關閉叢集快取】
- 儲存更改
等待節點流量降至極低或無流量。可透過檢視訪問日誌確認:
tail -f /usr/local/oredge-node/logs/access.log
4.2 降級
操作步驟類似,但降級元件選擇
Edge Node
[1] Edge Admin [2] Edge Admin Database [3] Rebuild [4] Edge Node [5] Edge Log Server [6] Edge Log Server Database Which component would you like to downgrade? 4 You chose: Edge Node.
輸入升級時生成的歷史記錄路徑:
Please enter the historical upgrade directory: /root/oredge-history/2024-07-01-02-03-04
輸入舊版本的 bundle 包路徑(僅適用於 bundle 包安裝方式)
Please enter the old bundle directory: /root/openresty-edge-bundle-VERSION
成功降級後,將顯示如下提示:
Great! Downgrade openresty-edge-node successfully.
5. 降級 Log Server
操作步驟類似,但降級元件選擇
Log Server
[1] Edge Admin [2] Edge Admin Database [3] Rebuild [4] Edge Node [5] Edge Log Server [6] Edge Log Server Database Which component would you like to downgrade? 5 You chose: Log Server.
輸入升級時生成的歷史記錄路徑:
Please enter the historical upgrade directory: /root/oredge-history/2024-07-01-02-03-04
輸入舊版本的 bundle 包路徑(僅適用於 bundle 包安裝方式)
Please enter the old bundle directory: /root/openresty-edge-bundle-VERSION
成功降級後,將顯示如下提示:
Great! Downgrade openresty-edge-log-server successfully.
6. 降級 Log Server 資料庫
操作步驟類似,但降級元件選擇
Log Server DB
[1] Edge Admin [2] Edge Admin Database [3] Rebuild [4] Edge Node [5] Edge Log Server [6] Edge Log Server Database Which component would you like to downgrade? 6 You chose: Log Server DB.
輸入當前版本號(僅適用於線上安裝方式)
Which version are you currently on? (like 24.3) 24.3
成功降級後,將顯示如下提示:
Great! downgrade log-server database successfully.
如遇任何問題,請隨時與我們聯絡溝通!