Updated on 2024-11-11 GMT+08:00

Gray Upgrade

Scenarios

You can use gray upgrade to upgrade your GaussDB instance if a version upgrade is required for new functions or issue rectification. You can either select auto-commit after the upgrade or perform a rolling upgrade.

  • In the auto-commit mode, all standby DNs are upgraded first and then primary DNs and CNs in sequence. After the upgrade is complete, the upgrade is automatically committed.
  • The rolling upgrade mode is also known as the upgrade observation mode. In this mode, the system enters the observation state after the upgrade is complete. During this period, you can observe the service status and either commit or roll back the upgrade based on service status.

Operation Process

Step

Description

Step 1: Perform a Pre-upgrade Check

Before an upgrade, check the instance status and whether monitoring metrics such as the CPU usage, memory usage, and disk usage of the instance are normal.

Step 2: Perform the Upgrade

Select either auto-commit after the upgrade or perform a rolling upgrade. You can upgrade a single instance or multiple instances in batches as required.

Step 3: Verify the Upgrade

After the upgrade is complete, check the instance status, backup creation status, and instance connectivity, and whether you can add, delete, update, and query data in the instance.

Precautions

  • The DN disk usage cannot be greater than the configured disk usage threshold minus 10%.

    To check the current DN disk usage, go to the metric monitoring page on the management console.

    To obtain the disk usage threshold, contact technical support.

  • Version upgrade is unavailable if instance nodes are in an abnormal state.
  • The rolling upgrade mode supports manual rollback, but the auto-commit mode does not support manual rollback.
  • During an upgrade or rollback, the following operations cannot be performed: scaling up storage, changing specifications, backing up data, resetting passwords, rebooting instances, and deleting instances.
  • You are advised to perform an upgrade during off-peak hours because there are more idle CPU, disk, and memory resources.
  • If upgrade auto-commit is used for a major version upgrade, log archiving will be disabled before the upgrade, and you cannot use archive logs for PITR, which may result in data loss.
  • If rolling upgrade is used for a major version upgrade, full backup cannot be triggered during the upgrade, and differential backup may fail. Manual full backups cannot be created until the upgrade operations in all AZs are complete during the rolling upgrade and observation period. Archive logs are still generated before the upgrade is committed, and you can use archive logs for PITR to prevent data loss. In the upgrade commit phase, log archiving is disabled.
  • If the upgrade fails, the system automatically rolls back the instance to the source version. You can contact Huawei Cloud technical support, and Huawei Cloud engineers will help you upgrade the instance if necessary.
  • Services are interrupted for about 10 seconds during the upgrade of primary DNs and during the upgrade of CNs.
  • After the upgrade is complete, an automated backup task will be triggered and log archiving will be enabled. However, an automated backup task will not be triggered in the case of minor version upgrades.

    Log archiving is available only for instances of versions later than V2.0-2.2.

    Example minor version upgrade: from V2.0-1.a.x to V2.0-1.a.y or from V2.0-2.a.x to V2.0-2.a.y

    Example major version upgrade: from V2.0-1.x to V2.0-2.x or from V2.0-2.x to V2.0-2.y

Step 1: Perform a Pre-upgrade Check

Before an upgrade, check the instance status and whether monitoring metrics such as the CPU usage, memory usage, and disk usage of the instance are normal.

  1. Check instance status.
    1. Log in to the management console.
    2. Click in the upper left corner and select a region and project.
    3. Click in the upper left corner of the page and choose Databases > GaussDB.
    4. On the Instances page, check whether the target instance is available.
      Figure 1 Instance status

      If the instance is in an abnormal state, contact Huawei Cloud technical support.

  2. Check monitoring metrics.
    1. Click in the upper left corner of the page, and choose Management & Governance > Cloud Eye.
    2. In the navigation pane, choose Cloud Service Monitoring > GaussDB.
    3. On the Cloud Service Monitoring page, click the target instance to go to the metric monitoring page.
      • On the DB Instance tab, view the value of Instance Disk Usage to check whether the disk usage is insufficient.
      • On the Node tab, view the value of CPU Usage to check whether the CPU usage remains high for a long time.
      • On the Node tab, view the value of Memory Usage to check whether the memory usage increases sharply.

      If any of the metrics are abnormal, contact Huawei Cloud technical support.

Step 2: Perform the Upgrade

You can select auto-commit after the upgrade or perform a rolling upgrade for gray upgrade as required.

[Method 1: upgrading a single instance]

  1. Click in the upper left corner of the page and choose Databases > GaussDB.
  2. On the Instances page, click More in the Operation column of the target instance and choose Upgrade.
  3. In the Upgrade Instance dialog box, select Gray upgrade for Upgrade Method.
  4. Select Auto-commit for Action.

    Figure 2 Upgrading an instance

  5. Select the target version, enter confirm, and click OK.
  6. Check the upgrade result on the Instances page.
    • During the upgrade, the instance status is Upgrading version.
    • After the upgrade is complete, the instance status changes to Available.
[Method 2: upgrading instances in batches]
  1. Click in the upper left corner of the page and choose Databases > GaussDB.
  2. On the Instances page, select the target instances and click Batch Upgrade.
    Figure 3 Batch upgrade

  3. In the Batch Upgrade dialog box, select Gray upgrade for Upgrade Method.
  4. Select Auto-commit for Action.
  5. Select the target version, enter confirm, and click OK.
    Figure 4 Auto-commit of a gray upgrade

  6. Check the upgrade result on the Instances page.
    • During the upgrade, the instance status is Upgrading version.
    • After the upgrade is complete, the instance status changes to Available.

[Method 1: upgrading a single instance]

  • Upgrading a distributed instance
    1. Click in the upper left corner of the page and choose Databases > GaussDB.
    2. On the Instances page, click More in the Operation column of the target instance and choose Upgrade.

      Alternatively, click the target instance name to go to the Basic Information page. In the Configuration area, click Upgrade Instance in the DB Engine Version field.

      Figure 5 Basic information
    3. In the Upgrade Instance dialog box, select Gray upgrade for Upgrade Method.
    4. Select Rolling upgrade for Action.
    5. Set Shards to Upgrade, select a target version, enter confirm, and click OK.
      Figure 6 Upgrading a distributed instance

    6. Check the upgrade result on the Instances page.
      1. During the upgrade, the instance status is Upgrading version.
      2. After the upgrade is complete, the instance status changes to Observing version upgrade.
    7. Check that all shards are upgraded and services are running properly before committing the upgrade.

      In the Upgrade Instance dialog box, select Commit for Action, select a target version, enter confirm, and click OK.

      Figure 7 Committing an upgrade

      If you choose to upgrade shards one by one, repeat 2 to 6 until all shards are upgraded, and then commit the upgrade.

  • Upgrading a centralized instance
    1. Click in the upper left corner of the page and choose Databases > GaussDB.
    2. On the Instances page, click More in the Operation column of the target instance and choose Upgrade.

      Alternatively, click the target instance name to go to the Basic Information page. In the Configuration area, click Upgrade Instance in the DB Engine Version field.

      Figure 8 Basic information
    3. In the Upgrade Instance dialog box, select Gray upgrade for Upgrade Method.
    4. Select Rolling upgrade for Action.
    5. Set AZs to Upgrade, select a target version, enter confirm, and click OK.
      Figure 9 Upgrading a centralized instance

      You can upgrade a single AZ or multiple AZs at a time as needed.

    6. Check the upgrade result on the Instances page.
      1. During the upgrade, the instance status is Upgrading version.
      2. After the upgrade is complete, the instance status changes to Observing version upgrade.
    7. Check that all AZs are upgraded and services are running properly before committing the upgrade.

      In the Upgrade Instance dialog box, select Commit for Action, select a target version, enter confirm, and click OK.

      Figure 10 Committing an upgrade

      If you choose to upgrade AZs one by one, repeat 2 to 6 until all AZs are upgraded, and then commit the upgrade.

[Method 2: upgrading instances in batches]
  1. Click in the upper left corner of the page and choose Databases > GaussDB.
  2. On the Instances page, select the target instances and click Batch Upgrade.
    Figure 11 Batch upgrade

  3. In the Batch Upgrade dialog box, select Gray upgrade for Upgrade Method.
  4. Select Rolling upgrade for Action.
  5. Select the target version, enter confirm, and click OK.
    Figure 12 Rolling upgrade of a gray upgrade

    In a rolling upgrade, all AZs or shards of the selected instances are upgraded by default.

  6. Check the upgrade result on the Instances page.
    • During the upgrade, the instance status is Upgrading version.
    • After the upgrade is complete, the instance status changes to Observing version upgrade.
  7. Check that all shards or AZs are upgraded and services are running properly before committing the upgrade.

    In the Batch Upgrade dialog box, select Commit for Action, select a target version, enter confirm, and click OK.

    Figure 13 Committing a batch gray upgrade

Step 3: Verify the Upgrade

After the upgrade is complete, check the instance status, backup creation status, and instance connectivity, and whether you can add, delete, update, and query data in the instance.

  1. On the Instances page, check whether Status of the target instance is Available.
  2. On the Instances page, click the name of the target instance. On the Basic Information page that is displayed, check whether the value of DB Engine Version in the Configuration area is the target version.
  3. Check that the automated backup triggered after the upgrade is successfully created.
    1. On the Instances page, click the name of the target instance to go to the Basic Information page.
    2. In the navigation pane, choose Backups. Check that a backup has been created and the backup status is Completed.
  4. Check that the instance is properly connected and you can add, delete, update, and query data in the instance.
    1. Log in to the database. For details, see Connecting to an Instance Through DAS.
    2. Go to the SQL Query page.
      Figure 14 SQL query
    3. Create a database.

      CREATE DATABASE database name;

      In this example, run the following command to create a database named db_tpcds:

      CREATE DATABASE db_tpcds;

      Switch to the newly created database in the upper left corner.

      Figure 15 Switching to the new database
    4. Create a table and add, delete, update, and query data in the table.
      1. Create a schema.

        CREATE SCHEMA myschema;

      2. Create a table named mytable that has only one column. The column name is firstcol and the column type is integer.

        CREATE TABLE myschema.mytable (firstcol int);

      3. Insert data into the table.

        INSERT INTO myschema.mytable VALUES (100);

      4. View the data in the table.

        SELECT * FROM myschema.mytable;

           | firstcol | 
        ---+----------+
        1  |   100    |
      5. Update data in the table.

        UPDATE myschema.mytable SET firstcol = 200;

      6. View the data in the table again.

        SELECT * FROM myschema.mytable;

           | firstcol | 
        ---+----------+
        1  |   200    |
      7. Delete the table.

        DROP TABLE myschema.mytable;

Rollback Operations

During upgrade observation, if a rollback is required due to service reasons or the upgrade using the rolling upgrade mode fails, you can manually roll back the upgrade by performing the steps in this section.

  • If the rollback is successful, you can perform the upgrade again.
  • If the rollback fails, you can perform the rollback again.

If the problem persists, contact Huawei Cloud technical support, and Huawei Cloud engineers will help you upgrade the instance if necessary.

  1. In the Upgrade Instance dialog box, select Rollback for Action, select a target version, enter confirm, and click OK.
  2. On the Instances page, check the rollback status. After the rollback is complete, the instance status changes to Available.
  3. On the Instances page, click the name of the target instance. On the Basic Information page that is displayed, check that the value of DB Engine Version in the Configuration area is the source version, that is, the version before upgrade.
  4. Check that the instance is properly connected and you can add, delete, update, and query data in the instance.

    1. Log in to the database. For details, see Connecting to an Instance Through DAS.
    2. Go to the SQL Query page.
      Figure 16 SQL query
    3. Create a database.

      CREATE DATABASE database_name;

      In this example, run the following command to create a database named db_tpcds:

      CREATE DATABASE db_tpcds;

      Switch to the newly created database in the upper left corner.

      Figure 17 Switching to the new database
    4. Create a table and add, delete, update, and query data in the table.
      1. Create a schema.

        CREATE SCHEMA myschema;

      2. Create a table named mytable that has only one column. The column name is firstcol and the column type is integer.

        CREATE TABLE myschema.mytable (firstcol int);

      3. Insert data into the table.

        INSERT INTO myschema.mytable values (100);

      4. View data in the table.

        SELECT * FROM myschema.mytable;

           | firstcol | 
        ---+----------+
        1  |   100    |
      5. Update data in the table.

        UPDATE myschema.mytable SET firstcol = 200;

      6. View the data in the table again.

        SELECT * FROM myschema.mytable;

           | firstcol | 
        ---+----------+
        1  |   200    |
      7. Drop the table.

        DROP TABLE myschema.mytable;

  1. On the Instances page, select the target instances and click Batch Upgrade.
  2. In the Batch Upgrade dialog box, select Rollback for Action, select a target version, enter confirm, and click OK.

  3. On the Instances page, check the rollback status. After the rollback is complete, the instance status changes to Available.
  4. On the Instances page, click the name of the target instance. On the Basic Information page that is displayed, check that the value of DB Engine Version in the Configuration area is the source version, that is, the version before upgrade.
  5. Check that the instance is properly connected and you can add, delete, update, and query data in the instance.

    1. Log in to the database. For details, see Connecting to an Instance Through DAS.
    2. Go to the SQL Query page.
      Figure 18 SQL query
    3. Create a database.

      CREATE DATABASE database_name;

      In this example, run the following command to create a database named db_tpcds:

      CREATE DATABASE db_tpcds;

      Switch to the newly created database in the upper left corner.

      Figure 19 Switching to the new database
    4. Create a table and add, delete, update, and query data in the table.
      1. Create a schema.

        CREATE SCHEMA myschema;

      2. Create a table named mytable that has only one column. The column name is firstcol and the column type is integer.

        CREATE TABLE myschema.mytable (firstcol int);

      3. Insert data into the table.

        INSERT INTO myschema.mytable values (100);

      4. View data in the table.

        SELECT * FROM myschema.mytable;

           | firstcol | 
        ---+----------+
        1  |   100    |
      5. Update data in the table.

        UPDATE myschema.mytable SET firstcol = 200;

      6. View the data in the table again.

        SELECT * FROM myschema.mytable;

           | firstcol | 
        ---+----------+
        1  |   200    |
      7. Drop the table.

        DROP TABLE myschema.mytable;