The purpose of this article is to introduce how to upgrade GaussDB stand-alone database from 1.0.0 to 1.0.2. Single machine supports automatic upgrade of small version and binary upgrade. For automatic upgrade, only one upgrade command needs to be executed on the node.
1. Upload package and decompress
Upload the following two packages to the same directory:
GaussDB_T_1.0.2-DATABASE-REDHAT-64bit.tar.gz DIALECT-SCRIPT-GaussDB_T_1.0.2.tar.gz [omm@hwd10 gaussdb]$ tar -xzf GaussDB_T_1.0.2-DATABASE-REDHAT-64bit.tar.gz
2. Create profile
[omm@hwd10 gaussdb]$ vi /opt/gaussdb/config_file.ini 192.168.120.31=/opt/software/gaussdb/GaussDB_T_1.0.2-DATABASE-REDHAT-64bit.tar.gz,/opt/gaussdb/app,/opt/gaussdb/ backup,/opt/gaussdb/data [omm@hwd10 gaussdb]$ mkdir /opt/gaussdb/backup
- 192.168.120.31 is the IP address of the server where the database is located.
- /Opt / software / gaussdb / gaussdb? 1.0.2-database-redhat-64bit.tar.gz is the absolute path of the upgrade package.
- /opt/gaussdb/app is the database installation path.
- /opt/gaussdb/backup is the storage path of backup files during the upgrade process (it needs to be created manually).
- /opt/gaussdb/data is the data file directory of the database instance. When installing multiple instances, the database instance started with the same installation directory must be upgraded at one time. At this time, the data directory of multiple database instances needs to be specified, and multiple data directories are separated by commas.
3. Get upgrade type (optional)
[omm@hwd10 ~]$ cd /opt/software/gaussdb/GaussDB_T_1.0.2-DATABASE-REDHAT-64bit [omm@hwd10 GaussDB_T_1.0.2-DATABASE-REDHAT-64bit]$ python upgrade.py -t upgrade-type --GSDB_HOME=/opt/gaussdb/app --GSDB_DATA=/opt/gaussdb/data --package=/opt/software/gaussdb/GaussDB_T/GaussDB_T_1.0.2-DATABASE-REDHAT-64bit.tar.gz --backupdir=/opt/gaussdb/backup Old version: 1.0.0.SPC1.B002 New version: 1.0.2.B319. systable-upgrade
When the upgrade type: binary upgrade. Is returned, binary upgrade is performed during automatic upgrade; when the upgrade type: systable upgrade. Is returned, minor upgrade is performed during automatic upgrade.
4. Upgrade environment check
[omm@hwd10 GaussDB_T_1.0.2-DATABASE-REDHAT-64bit]$ python upgrade.py -s pre-check --config-file=/opt/gaussdb/config_file.ini --upgrade-mode=single Begin to precheck for single upgrade. Old version: 1.0.0.SPC1.B002 New version: 1.0.2.B319. Precheck for single upgrade finished. Upgrade [pre-check] step successfully. [omm@hwd10 GaussDB_T_1.0.2-DATABASE-REDHAT-64bit]$
5. Perform one click upgrade
[omm@hwd10 GaussDB_T_1.0.2-DATABASE-REDHAT-64bit]$ python upgrade.py -s run --config-file=/opt/gaussdb/config_file.ini --upgrade-mode=single Old version: 1.0.0.SPC1.B002 New version: 1.0.2.B319. Precheck step for single upgrade. Prepare step for single upgrade. Replace step for single upgrade. Begin distrubute key to other instances. output: attr:MOUNT single=============output: connected. SQL> VALUE ---------------------------------------------------------------- (/opt/gaussdb/data/protect/kmc_a.ksf, /opt/gaussdb/data/protect/kmc_b.ksf) 1 rows fetched. single===========status:0 Start step for single upgrade. Upgrade step for single upgrade. Sync step for single upgrade. Dbcheck step for single upgrade. Flush step for single upgrade. Run for single upgrade finished. Upgrade [run] step successfully.
After the upgrade is completed, the database is closed, and the database is opened. You can also get the upgraded version information by querying the version view.
6. Clean up the environment
The log file (upgrade.log file) generated during the upgrade process will be deleted when cleaning up the environment. If you need to view it later, please save the upgrade.log file manually before performing cleanup. The storage path of the upgrade.log file is / opt/gaussdb/backup / ha? Upgrade? Backup / upgrade.log, where / opt/gaussdb/backup is the storage path of the backup file in the upgrade process manually created by the user.
[omm@hwd10 GaussDB_T_1.0.2-DATABASE-REDHAT-64bit]$ python upgrade.py -s cleanup --config-file=/opt/gaussdb/config_file.ini --upgrade-mode=single clean backup and tmp files. Upgrade [cleanup] step successfully.
7. Rollback operation
If the database upgrade fails, the database needs to be rolled back automatically.
7.1 rollback check
Enter the directory where upgrade.py is located, and execute the following command:
[omm@hwd10 ~]$ cd /opt/software/gaussdb/GaussDB_T_1.0.2-DATABASE-REDHAT-64bit [omm@hwd10 GaussDB_T_1.0.2-DATABASE-REDHAT-64bit]$ python upgrade.py -s rollback-check --config-file=/opt/gaussdb/config_file.ini --upgrade-mode=single
7.2 performing a rollback
[omm@hwd10 GaussDB_T_1.0.2-DATABASE-REDHAT-64bit]$ python upgrade.py -s rollback --config-file=/opt/gaussdb/config_file.ini --upgrade-mode=single