Version upgrade

更新时间:
复制 MD 格式

After you purchase the version upgrade service, follow these steps to upgrade PolarDB for PostgreSQL (PolarFlex).

Precautions

  • Version upgrades involve a cluster restart. Perform this operation during off-peak hours.

  • The database engine upgrade process involves a cluster switch. Perform this operation during off-peak hours.

  • The cluster disconnects during the proxy component upgrade. Perform this operation during off-peak hours.

PolarFlex version upgrade

Note

This topic uses an upgrade from version 2.3.2 to 2.3.2.1 as an example.

  1. Create a new version folder for pdbcli and decompress the new version installation package.

    mkdir polarflex-2.3.2.1
    tar -C polarflex-2.3.2.1 -xf polarflex-2.3.2.1.tar.gz
  2. Change to the working directory and run the following installation command. This command requires sudo permissions.

    ./scripts/install.sh
  3. Check the config.yaml file. Copy the config.yaml file, which contains information such as host IP addresses and parameters, from the old polarflex folder to the new polarflex-2.3.2.1 folder. This action overwrites the current config.yaml file. Then, confirm that the parameters are as expected.

    cp polarflex-2.3.2/config.yaml polarflex-2.3.2.1/config.yaml 
  4. Upgrade the cluster components in the following order.

    1. Upgrade the high availability (HA) component.

      pdbcli upgrade cm

      Wait for 10 seconds, and then run pdbcli status to check the cluster status. After the HA component is upgraded, a new primary node is elected. You may see the error {"code":500,"msg":"Failed to request cause no CM leader!"}. If this error occurs, wait for the process to complete.

    2. Upgrade the database engine.

      pdbcli upgrade db

      This process is interactive. Enter yes to proceed. If you use a single-node cluster, add the --force parameter. Wait for 10 seconds, and then run pdbcli status to check the cluster status. The upgrade is successful if the status of all components is RUNNING.

    3. Upgrade the proxy component.

      pdbcli upgrade proxy

      This process is interactive. Enter yes to proceed. Wait for 10 seconds, and then run pdbcli status to check the cluster status. The upgrade is successful if the status of all components is RUNNING.

  5. Check the license file.

    If you have already installed a license, copy the `license` folder from the previous version's directory to the `polarflex-2.3.2.1` directory. This action overwrites the `license` folder for the new version. Then, confirm that a license file exists in the `license` directory.

    cp -r polarflex-2.3.2/license polarflex-2.3.2.1/