降級 OpenResty Edge

1. 回滾 Edge Admin

  • 下載安裝器
curl -O https://openresty.com/client/oredge/openresty-edge-installer.sh
  • 執行安裝器
sudo /bin/bash openresty-edge-installer.sh
  • 輸入您要執行的操作 Downgrade
What would you like to do?
[1] Install
[2] Upgrade
[3] Downgrade
[4] Uninstall
2
What you choose is: Downgrade.
  • 輸入您想要降級的版本 (升級前的版本)
Which version would you like to downgrade to? (like 22.6.1-1)
22.6.1-1
  • 輸入您要降級的元件 Edge Admin
Which component would you like to downgrade?
[1] Edge Admin
[2] Edge Admin DB
[3] Rebuild
[4] Edge Node
[5] Log Server
[6] Log Server DB
1
What you choose is: Edge Admin.
  • 輸入對應的 openresty-plus 版本
Which version of openresty-plus would you like to downgrade to? (like 1.19.9.1.3-1)
1.19.9.1.15-1
  • 如果成功,最後會有如下提示
Great! Downgrade openresty-edge-admin successfully."

2. 回滾 Edge Admin 資料庫

  • 操作步驟相同,降級時元件選擇 Edge Admin DB
Which component would you like to downgrade?
[1] Edge Admin
[2] Edge Admin DB
[3] Rebuild
[4] Edge Node
[5] Log Server
[6] Log Server DB
2
What you choose is: Edge Admin DB.
  • 輸入當前的版本
Which version are you currently on? (like 22.6.1)
22.6.1
  • 如果成功,最後會有如下提示
Great! update admin database successfully.

3. 重新編譯

  • 操作步驟相同,降級時元件選擇 Rebuild
Which component would you like to downgrade?
[1] Edge Admin
[2] Edge Admin DB
[3] Rebuild
[4] Edge Node
[5] Log Server
[6] Log Server DB
3
What you choose is: 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 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 global? [Y/N]:  y
rebuild global
recompile global successfully

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.

Do you want to rebuild global-action? [Y/N]:  y
rebuild global-action
recompile global action successfully

Do you want to rebuild gateway? [Y/N]:  y
rebuild gateway
recompiled gateway 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

4.1 遷移流量(可選)

為避免影響業務,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
Which component would you like to downgrade?
[1] Edge Admin
[2] Edge Admin DB
[3] Rebuild
[4] Edge Node
[5] Log Server
[6] Log Server DB
4
What you choose is: Edge Node.
  • 如果成功,最後會有如下提示
Great! Downgrade openresty-edge-node successfully.

5. 回滾 Log Server

  • 操作步驟相同,降級時元件選擇 Log Server
Which component would you like to downgrade?
[1] Edge Admin
[2] Edge Admin DB
[3] Rebuild
[4] Edge Node
[5] Log Server
[6] Log Server DB
5
What you choose is: Log Server.
  • 如果成功,最後會有如下提示
Great! Downgrade openresty-edge-log-server successfully.

6. 回滾 Log Server 資料庫

  • 操作步驟相同,降級時元件選擇 Log Server DB
Which component would you like to downgrade?
[1] Edge Admin
[2] Edge Admin DB
[3] Rebuild
[4] Edge Node
[5] Log Server
[6] Log Server DB
2
What you choose is: Log Server DB.
  • 輸入當前的版本
Which version are you currently on? (like 22.6.1)
22.6.1
  • 如果成功,最後會有如下提示
Great! downgrade log-server database successfully.

有問題請與我們隨時溝通!