Downgrade OpenResty Edge Offline
Notice
If the upgrade failed, the following steps can be performed to downgrade, please make an appointment with OpenResty colleagues to downgrade before downgrading.1. prepare the old offline package
If you don’t have the old offline package named Edge-Offline-VERSION.tar.gz
, please login and download it at OpenResty Download Center using your email address.
tar xf Edge-Offline-VERSION.tar.gz
# Example: tar xf Edge-Offline-20210721.tar.gz
Usually the offline package will contain the following files:
openresty-postgresql.tar.gz
openresty-edge-admin.tar.gz
openresty-edge-node.tar.gz
openresty-edge-log-server.tar.gz
update-admin-db-VERSION.sh
, use only when upgradingupdate-log-server-db-VERSION.sh
, use only when upgradinginit_admin_db_VERSION.sh
, use only during installationinit_log_server_db_VERSION.sh
, use only during installation
2. Downgrade Edge Admin
# Download the downgrade script
curl -O https://openresty.com/client/oredge/downgrade-edge-admin-offline.sh
# Place the script in the directory of the old Edge Admin offline installation package
cp downgrade-edge-admin-offline.sh <old-packages-dir>
# Run the downgrade script
sudo bash downgrade-edge-admin-offline.sh
# check
sudo rpm -qa | grep edge
# or
sudo dpkg -l | grep edge
3. Downgrade Edge Admin database
# Transfer the script to the machine where the Edge Admin database is located
# Example:bash downgrade-admin-db-217-180.sh
bash downgrade-admin-db-VERSION.sh
4. Recompile
Please recompile the application in the following order:
- Recompile a few applications that do not contain wildcard domains with less traffic first
- Recompile several high-traffic applications that do not contain wildcard domains
- Recompile all wildcard applications
- Recompile all applications
- Recompile global rules
cd /usr/local/oredge-admin/
# recompile the specified application (replace APP-ID with application ID)
sudo bash utils/recompile-apps.sh http APP-ID
# recompile all applications
sudo bash utils/recompile-apps.sh wildcard-http
sudo bash utils/recompile-apps.sh http
sudo bash utils/recompile-apps.sh http_proxy
sudo bash utils/recompile-apps.sh socks5_proxy
# recompile global rules
sudo bash utils/recompile-apps.sh global
# recompile waf rules
sudo bash utils/recompile-apps.sh waf
# recompile DNS applications
sudo bash utils/recompile-apps.sh dns
# recompile global actions
sudo bash utils/recompile-apps.sh global-action
# recompile gateway (may trigger OpenResty Edge Node reload)
sudo bash utils/recompile-apps.sh gateway
If the whole system behave normally, the downgrade is complete!
this step may take longer to compile when there are many HTTP/HTTPS applications.
sudo /bin/bash utils/recompile-apps.sh http
We recommend using another tool for concurrent compilation then. The following command will start 4 processes to compile.
sudo /bin/bash utils/parallel-recompile.sh
If it is not fast enough, you can also specify a larger concurrency, but not larger than 8, e.g.
sudo /bin/bash utils/parallel-recompile.sh 8
5. Downgrade Edge Node
Downgrade 1~2
Edge Nodes first, and then downgrade all Edge Node after there are no problems, please pay attention to the error log during the downgrade.
Cut away traffic. If you are using Edge’s DNS, follow these steps; otherwise, proceed as you see fit.
Take the Edge Node you want to downgrade offline.
- Enter the [Gateway Clusters].
- [Edit] The cluster where the node is located.
- Modify the node’s [status] to [Disable DNS, disable caching cluster].
- [Save]
Wait for the node to no longer have traffic. You could confirm by checking the access log:
tail -f /usr/local/oredge-node/logs/access.log
This process requires waiting for DNS to expire, which can be time-consuming.
Downgrade:
# Download the downgrade script curl -O https://openresty.com/client/oredge/downgrade-edge-node-offline.sh # Place the script in the directory of the old Edge Node offline installation package cp downgrade-edge-node-offline.sh <old-packages-dir> # Run the downgrade script sudo bash downgrade-edge-node-offline.sh
6. Downgrade Log Server
# Download the downgrade script
curl -O https://openresty.com/client/oredge/downgrade-edge-log-server-offline.sh
# Place the script in the directory of the old Edge Log Server offline installation package
cp downgrade-edge-log-server-offline.sh <old-packages-dir>
# Run the downgrade script
sudo bash downgrade-edge-log-server-offline.sh
7. Downgrade Log Server Database
# Transfer the script to the machine where the Log Server database is located
bash downgrade-log-server-db-VERSION.sh
# Example:bash downgrade-log-server-db-49-41.sh
If you have any questions, please contact us.