Downgrade OpenResty Edge Offline
NoticeIf 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:
update-admin-db-VERSION.sh, use only when upgrading
update-log-server-db-VERSION.sh, use only when upgrading
init_admin_db_VERSION.sh, use only during installation
init_log_server_db_VERSION.sh, use only during installation
2. Downgrade 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 -x downgrade-edge-admin-offline.sh # check sudo rpm -qa | grep edge
3. Downgrade Admin database
# Transfer the script to the machine where the Admin database is located # Example：bash downgrade-admin-db-217-180.sh bash downgrade-admin-db-VERSION.sh
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 Node
1~2 Nodes first, and then downgrade all 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 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].
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.
# 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 -x 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 -x 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.