You can upgrade OceanBase Shell (OBShell) in the following ways:
Upgrade OBShell by calling API operations
Upgrade OBShell by using the CLI
This topic describes how to upgrade OBShell in an OceanBase cluster with three replicas.
Prerequisites
The OceanBase cluster is managed by OBShell. For more information, see Take over an OceanBase cluster not deployed by OBShell.
All OBServer nodes and OBShell processes in the OceanBase cluster are running normally.
Deployment mode
The following table describes the three machines in the OceanBase cluster, with OBShell using the default port 2886.
| Role | Machine | Remarks |
|---|---|---|
| OBServer node | 10.10.10.1 | In OceanBase Database Zone 1 |
| OBServer node | 10.10.10.2 | In OceanBase Database Zone 2 |
| OBServer node | 10.10.10.3 | In OceanBase Database Zone 3 |
Upgrade OBShell by calling API operations
Note
OBShell verifies the security of requested API operations. Therefore, you must encrypt the request before you call an API operation. For more information, see Hybrid encryption for API operations. You must also specify ${request_headers} and ${request_body} in the curl command.
Step 1: Upload the RPM package of the target version
Call the /api/v1/upgrade/package API operation in any OBShell process to upload the package. The obshell package is required. For more information, see UploadPkg.
[admin@test001 ~]$ curl -H 'X-OCS-Header:${request_headers}' -X POST -F "file=@/data/upgrade/obshell-4.2.2.0-xxx.el7.x86_64.rpm" http://10.10.10.1:2886/api/v1/upgrade/package
(Optional) Step 2: Call the upgrade check API operation
Call the /api/v1/agent/upgrade/check API operation in any OBShell process to perform the upgrade check. The upgrade check verifies whether the package of the target version has been uploaded and whether the products required for the upgrade are all obtained. For more information, see AgentUpgradeCheck. The API operation creates an asynchronous task. For more information about how to query the task progress, see GetDagDetails. Wait for the upgrade check task to complete.
[admin@test001 ~]$ curl -H "Content-Type: application/json" -H 'X-OCS-Header:${request_headers}' -X POST -d '${request_body}' http://10.10.10.1:2886/api/v1/agent/upgrade/check
Step 3: Call the upgrade API operation
Call the /api/v1/agent/upgrade API operation in any OBShell process to perform the upgrade. For more information, see UpgradeAgent. The API operation creates an asynchronous O&M task. For more information about how to query the task progress, see GetDagDetails. Wait for the upgrade task to complete.
[admin@test001 ~]$ curl -H "Content-Type: application/json" -H 'X-OCS-Header:${request_headers}' -X POST -d '${request_body}' http://10.10.10.1:2886/api/v1/agent/upgrade
Step 4: Verify the upgrade result
Log on to the sys tenant of OceanBase Database as the root user, and run the following command to query the OBShell version:
obclient [oceanbase]> select version from ocs.all_agent;
Upgrade OBShell by using the CLI
Step 1: Run the upgrade command to perform the upgrade
Run the obshell agent upgrade command on any OBServer node. Use -d to specify the path to the package of the target version. For more information, see obshell agent upgrade.
[admin@test001 ~]$ /home/admin/oceanbase/bin/obshell agent upgrade -d /data/upgrade/
Step 2: Verify the upgrade result
Log on to the sys tenant of OceanBase Database as the root user, and run the following command to query the OBShell version:
obclient [oceanbase]> select version from ocs.all_agent;