OpenGauss database 3.0.0 upgrade 5.0.0 operation practice

 

Article directory

  • 1.1 Preface
  • 1.2 Upgrade Notes
    • upgrade process
    • Upgrade method
    • upgrade constraints
  • 1.3 Preparations before upgrading
  • 1.4 Upgrade operation
  • 1.5 Upgrade Verification
  • 1.6 Submit an upgrade

 

1.1 Preface

openGauss is an open source relational database management system released under the Mulan Permissive License v2. I have done some practice based on version 3.0.0 before. This article will introduce in detail how to upgrade the openGauss database from version 3.0.0 to the latest version 5.0.0.

1.2 Upgrade Notes

upgrade process

 

Upgrade method

After the user selects the upgrade method, the system will automatically judge and select the appropriate upgrade strategy.

  • In-place upgrade: During the upgrade period, the business needs to be stopped, and all nodes are upgraded at one time.
  • Grayscale upgrade: Grayscale upgrade supports full-service operations, and also upgrades all nodes at one time. (The version after openGauss1.1.0 supports this function)
  • Rolling upgrade: Based on the grayscale upgrade, it supports the upgrade of specified nodes and supports the upgrade of some nodes. (The version after openGauss3.1.0 supports this function).
    This time we use the grayscale upgrade method.

upgrade constraints

The upgrade constraints official website document lists them in detail, so I won’t list them one by one. The main thing is not to make additions, deletions or changes during the upgrade. Production and commercial environments must perform as required.

1.3 Preparations before upgrading

1. Check the OS.

[root@hecs-1105531 etc]# cat centos-release
CentOS Linux release 7.6.1810 (Core)

2. Check the pre-upgrade version

[omm@hecs-1105531 ~]$ gsql --version
gsql (openGauss 3.0.0 build 02c14696) compiled at 2022-04-01 18:12:34 commit 0 last mr

3. Check the disk usage of the database node, and perform the upgrade operation when it is lower than 80%.

[omm@hecs-1105531 ~]$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        1.9G     0  1.9G   0% /dev
tmpfs           1.9G   24K  1.9G   1% /dev/shm
tmpfs           1.9G  175M  1.7G  10% /run
tmpfs           1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/vda1        40G  9.3G   28G  25% /
tmpfs           379M     0  379M   0% /run/user/0

4. Log in to the node as a database user (such as omm) and confirm that the database status is Normal.

[omm@hecs-1105531 ~]$ gs_om -t status
--------------------------------------------------------------------

cluster_name    : ogCluster
cluster_state   : Normal
redistributing  : No

----------------------------------------------------------------------

5. Execute the following command as the root user to check the OS parameters of the server. The purpose of checking the OS parameters of the server is to ensure that the database passes the pre-installation normally and can run safely and efficiently after the installation is successful. For detailed check items, see the tool "Server Tools > gs_checkos" in the Tool Reference.

cd /root/gauss_om/omm/script/
gs_checkos -i A

 

6. The official website does not have a separate upgrade package, so get a new version package according to the situation. The basic version of this operation is the centos enterprise version, continue to obtain the 5.0.0 enterprise version.
https://opengauss.org/zh/download.html

7. Manual backup
Once the upgrade fails, it may affect the normal development of the business. If you have important data, please refer to the "Backup and Restoration" chapter in the "Database Operation and Maintenance Guide" to complete the data backup.

1.4 Upgrade operation

1. The root user creates a new package directory.

mkdir -p /opt/software/gaussdb_upgrade

2. Upload the new package that needs to be updated to the directory "/opt/software/gaussdb_upgrade" and decompress it.

[root@hecs-1105531 script]# mkdir -p /opt/software/gaussdb_upgrade
[root@hecs-1105531 script]# cp /opt/software/openGauss-5.0.0-CentOS-64bit-all.tar.gz /opt/software/gaussdb_upgrade/
[root@hecs-1105531 script]# cd /opt/software/gaussdb_upgrade
[root@hecs-1105531 gaussdb_upgrade]# tar -zxvf openGauss-5.0.0-CentOS-64bit-all.tar.gz
[root@hecs-1105531 gaussdb_upgrade]# tar -zxvf openGauss-5.0.0-CentOS-64bit-om.tar.gz

3. Enter the script directory extracted from the installation package, and execute the pre-script gs_preinstall before upgrading. cluster_config.xml is the file used to install the base version earlier.

cd /opt/software/gaussdb_upgrade/script
./gs_preinstall -U omm -G dbgrp -X  /opt/software/openGauss/cluster_config.xml

The execution process is as follows

[root@hecs-1105531 script]# ./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/cluster_config.xml
Parsing the configuration file.
Successfully parsed the configuration file.
Installing the tools on the local node.
Successfully installed the tools on the local node.
Setting host ip env
Successfully set host ip env.
Are you sure you want to create the user[omm] (yes/no)? no
Preparing SSH service.
Successfully prepared SSH service.
Checking OS software.
Successfully check os software.
Checking OS version.
Successfully checked OS version.
Creating cluster's path. Successfully created cluster's path.
Set and check OS parameter.
Setting OS parameters.
Successfully set OS parameters.
Warning: Installation environment contains some warning messages.
Please get more details by "/opt/software/gaussdb_upgrade/script/gs_checkos -i A -h hecs-1105531 --detail".
Set and check OS parameter completed.
Preparing CRON service.
Successfully prepared CRON service.
Setting user environmental variables.
Successfully set user environmental variables.
Setting the dynamic link library.
Successfully set the dynamic link library.
Setting Core file
Successfully set core path.
Setting pssh path
Successfully set pssh path.
Setting Cgroup.
Successfully set Cgroup.
Set ARM Optimization.
No need to set ARM Optimization.
Fixing server package owner.
Setting finish flag.
Successfully set finish flag.
Preinstallation succeeded.

4. Switch to the omm user and use the following commands to perform an in-place or grayscale upgrade. Finally, it is prompted to successfully upgrade all nodes. That's it.

[omm@hecs-1105531 ~]$ gs_upgradectl -t auto-upgrade -X /opt/software/openGauss/cluster_config.xml --grey
Static configuration matched with old static configuration files.
Successfully set upgrade_mode to 0.
Checking upgrade environment.
Successfully checked upgrade environment.
Start to do health check.
Successfully checked cluster status.
Upgrade one node 'hecs-1105531'.
NOTICE: The directory /opt/huawei/install/app_02c14696 will be deleted after commit-upgrade, please make sure there is no personal data.
Performing grey rollback.
No need to rollback.
The directory /opt/huawei/install/app_02c14696 will be deleted after commit-upgrade, please make sure there is no personal data.
Installing new binary.
copy certs from /opt/huawei/install/app_02c14696 to /opt/huawei/install/app_a07d57c3.
Successfully copy certs from /opt/huawei/install/app_02c14696 to /opt/huawei/install/app_a07d57c3.
Successfully backup hotpatch config file.
Sync cluster configuration.
Successfully synced cluster configuration.
Switch symbolic link to new binary directory.
Successfully switch symbolic link to new binary directory.
Start check CMS parameter.
Switching all db processes.
Check cluster state.
Cluster state: [   Cluster State   ]

cluster_state   : Normal
redistributing  : No
current_az      : AZ_ALL

[  Datanode State   ]

    node        node_ip         port      instance     state
----------------------------------------------------------------------------
1  hecs-1105531 192.168.0.243   15400      6001       P Primary Normal
Create checkpoint before switching.
Start to wait for om_monitor.
Switching DN processes.
Ready to grey start cluster.
Grey start cluster successfully.
Wait for the cluster status normal or degrade.
Successfully switch all process version
The nodes ['hecs-1105531'] have been successfully upgraded to new version. Then do health check.
Start to do health check.
Successfully checked cluster status.
Waiting for the cluster status to become normal.
.
The cluster status is normal.
Upgrade main process has been finished, user can do some check now.
Once the check done, please execute following command to commit upgrade:

    gs_upgradectl -t commit-upgrade -X /opt/software/openGauss/cluster_config.xml

Successfully upgrade all nodes.

1.5 Upgrade Verification

Execute the following command as a database user (such as omm) to view the database status. If the cluster_state of the query result is Normal, the database is normal.

gs_om -t status
gs_ssh -c "gsql -V"

 

Users can authenticate other database objects themselves.

1.6 Submit an upgrade

After the upgrade is complete, if there is no problem with the verification, the upgrade can be submitted next. It should be noted that once the submission operation is completed, the rollback operation cannot be performed.
Execute the following command as a database user (such as omm) to complete the upgrade submission.

[omm@hecs-1105531 ~]$ gs_upgradectl -t commit-upgrade  -X /opt/software/openGauss/cluster_config.xml

 

So far, the upgrade of openGauss3.0.0 to version 5.0.0 is completed.

{{o.name}}
{{m.name}}

Guess you like

Origin my.oschina.net/gaussdb/blog/8796404