Help Center> GaussDB> API Reference> APIs (Recommended)> Version Upgrade> Upgrading Kernel Versions of Instances in Batches
Updated on 2024-07-12 GMT+08:00

Upgrading Kernel Versions of Instances in Batches

Function

This API is used to upgrade kernel versions of instances in batches. There are three upgrade types: gray upgrade, in-place upgrade, and hot patch upgrade. The earliest version of all selected instances must be earlier than available target versions, and they must support the same upgrade method and action. For a batch gray upgrade, the default action is to upgrade all AZs and shards. For a batch hot patch upgrade, only the auto-commit process is available.

  • In-place upgrade: Services are interrupted for about 30 minutes during the upgrade, and all nodes in the instance are upgraded at the same time.
  • Gray upgrade:
    Services are interrupted for 10s during the upgrade of each primary DN or CN. The management plane is upgraded before the data plane from the standby nodes to the primary nodes.
    • Auto-commit: All node processes are upgraded simultaneously. This upgrade involves an anticipated service disruption of approximately 10 seconds, while keeping the rest of the system operational.
    • Rolling upgrade: You can observe service status before committing the upgrade. There are upgrade and commit phases.
      • In the upgrade phase, DB instances can be upgraded by shard or AZ based on the deployment model.
        • Distributed instances are upgraded by shards. When instances are upgraded in batches, all shards are upgraded by default.
        • Primary/standby instances are upgraded by AZs. When instances are upgraded in batches, all shards are upgraded by default.
      • In the commit phase, you can test services on your instance after the upgrade is complete, and then either commit or roll back the upgrade based on test results.
        • Commit: After the upgrade is complete and services are normal, commit the upgrade.
        • Rollback: When you commit the upgrade, you can roll back the instance to the source version as required.
  • Hot patch upgrade

    Auto-commit: Hot patches are automatically upgraded and committed without downtime. Only product bugs are fixed.

URI

PUT https://{Endpoint}/v3/{project_id}/instances/db-upgrade

Table 1 Parameter description

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID of a tenant in a region.

Request Parameters

Table 2 Request parameters

Parameter

Mandatory

Type

Description

instance_ids

No

Array of strings

Instance IDs for batch upgrade.

upgrade_type

Yes

String

Instance upgrade type. There are three types of upgrade: in-place upgrade, gray upgrade, and hot patch upgrade.

Value:

  • inplace: In-place upgrade
  • grey: Gray upgrade
  • hotfix: Hot patch upgrade

upgrade_action

No

String

Instance upgrade action. For an in-place upgrade, this parameter does not need to be specified. For a gray upgrade, this parameter can be set to upgradeAutoCommit, upgrade, commit, or rollback.

Value:

  • upgradeAutoCommit: Auto-commit
  • upgrade: Rolling upgrade
  • commit: Commit
  • rollback: Rollback

target_version

No

String

Target version that the instances are upgraded to in batches. This parameter is optional. For a gray upgrade or an in-place upgrade, if this parameter is not specified, the instances are upgraded to the preferred version by default. For a hot patch upgrade, this parameter does not need to be specified and all available hot patches are upgraded by default.

Response Parameters

Table 3 Response parameters

Parameter

Type

Description

job_ids

Array of strings

Task ID.

succeeded_num

Integer

Number of instances whose task requests are submitted successfully.

failed_num

Integer

Number of instances whose task requests fail to be submitted.

failed_instance_ids

Array of strings

IDs of instances whose task requests fail to be submitted.

error_messages

Array of strings

List of error information about task submission failures.

Example Request

  • Upgrading instances in batches using the in-place upgrade
    PUT https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/v3/0483b6b16e954cb88930a360d2c4e663/instances/db-upgrade
    { 
      "instance_ids" : [ "cc0ae5c47bf94834bf9e44138f7f995ain14", "aa0ae5c47bf94834bf9e44138f7f995ain14" ], 
      "upgrade_type" : "inplace" , 
      "target_version" : "8.100.0" 
    }
  • Upgrading instances in batches using the gray upgrade with the rolling upgrade action
    PUT https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/v3/0483b6b16e954cb88930a360d2c4e663/instances/db-upgrade
    { 
      "instance_ids" : [ "cc0ae5c47bf94834bf9e44138f7f995ain14", "aa0ae5c47bf94834bf9e44138f7f995ain14" ], 
      "upgrade_type" : "grey", 
      "upgrade_action" : "upgrade", 
      "target_version" : "8.100.0" 
    }
  • Upgrading instances in batches using the gray upgrade with the rollback action
    PUT https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/v3/0483b6b16e954cb88930a360d2c4e663/instances/db-upgrade
    { 
      "instance_ids" : [ "cc0ae5c47bf94834bf9e44138f7f995ain14", "aa0ae5c47bf94834bf9e44138f7f995ain14" ], 
      "upgrade_type" : "grey", 
      "upgrade_action" : "rollback", 
      "target_version" : "8.100.0" 
    }
  • Upgrading instances in batches using the gray upgrade with the auto-commit action
    PUT https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/v3/0483b6b16e954cb88930a360d2c4e663/instances/db-upgrade
    { 
      "instance_ids" : [ "cc0ae5c47bf94834bf9e44138f7f995ain14", "aa0ae5c47bf94834bf9e44138f7f995ain14" ], 
      "upgrade_type" : "grey", 
      "upgrade_action" : "upgradeAutoCommit", 
      "target_version" : "8.100.0" 
    }
  • Upgrading instances in batches using the hot patch upgrade with the auto-commit action
    PUT https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/v3/0483b6b16e954cb88930a360d2c4e663/instances/db-upgrade
    { 
      "instance_ids" : [ "cc0ae5c47bf94834bf9e44138f7f995ain14", "aa0ae5c47bf94834bf9e44138f7f995ain14" ], 
      "upgrade_type" : "hotfix", 
      "upgrade_action" : "upgradeAutoCommit" 
    }

Example Response

{ 
  "job_ids" : [ "2b414788a6004883a02390e2eb0ea227", "aa414788a6004883a02390e2eb0ea228" ], 
  "succeeded_num" : 2, 
  "failed_num" : 1, 
  "failed_instance_ids" : [ "cc0ae5c47bf94834bf9e44138f7f995ain14" ], 
"error_messages": ["This operation cannot be performed because the instance status is abnormal."]
}

Status Code

Error Code

For details, see Error Codes.