降级 OpenResty Edge

1. 回滚 Admin

  • 下载安装器
curl -O https://openresty.com/client/oredge/openresty-edge-tool.sh
  • 运行安装器
sudo /bin/bash openresty-edge-tool.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
  • 输入您要降级的组件 Admin
Which component would you like to downgrade?
[1] Admin
[2] Admin DB
[3] Rebuild
[4] Node
[5] Log Server
[6] Log Server DB
1
What you choose is: 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. 回滚 Admin 数据库

  • 操作步骤相同,降级时组件选择 Admin DB
Which component would you like to downgrade?
[1] Admin
[2] Admin DB
[3] Rebuild
[4] Node
[5] Log Server
[6] Log Server DB
2
What you choose is: 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] Admin
[2] Admin DB
[3] Rebuild
[4] 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. 回滚 Node

4.1 迁移流量(可选)

为避免影响业务,Node 节点降级前,把该节点上的流量转移到其他未升级节点上。 此步骤为可选,但是强烈建议对最初升级的少数 Node 执行此步骤:

  • 迁移走流量
  • 升级
  • 验证

没问题后,再升级剩下的 Node 。另外,升级过程中请关注错误日志。

如果使用的 OpenResty Edge 的 DNS 控制流量,请按以下步骤把即将升级的 Node 节点下线。

  • 进入 OpenResty Edge 控制台
  • 进入【网关集群】页面
  • 对节点所在集群进行【编辑】
  • 修改节点【状态】为【关闭 DNS,关闭集群缓存】
  • 保存

等待节点不再有流量或只有少量流量。可通过查看访问日志确定:

tail -f /usr/local/oredge-node/logs/access.log

4.2 回滚

  • 操作步骤相同,降级时组件选择 Node
Which component would you like to downgrade?
[1] Admin
[2] Admin DB
[3] Rebuild
[4] Node
[5] Log Server
[6] Log Server DB
4
What you choose is: Node.
  • 如果成功,最后会有如下提示
Great! Downgrade openresty-edge-node successfully.

5. 回滚 Log Server

  • 操作步骤相同,降级时组件选择 Log Server
Which component would you like to downgrade?
[1] Admin
[2] Admin DB
[3] Rebuild
[4] 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] Admin
[2] Admin DB
[3] Rebuild
[4] 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.

有问题请与我们随时沟通!