降级 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.
如遇任何问题,请随时与我们联系沟通!