标签:ssdb 存储 图片 数据文件 value sof other inf new
本文旨在介绍如何升级GaussDB单机版数据库,从1.0.0升级到1.0.2版本。单机支持小版本升级和二进制升级这两种类型的自动升级。进行自动升级时,只需要在节点上执行一次升级命令。上传以下两个软件包至同一目录:
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
[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
[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
返回Upgrade type: binary-upgrade.时,自动升级时进行二进制升级;返回Upgrade type: systable-upgrade.时,自动升级时进行小版本升级。
[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]$
[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.
升级完成后,数据库处于关闭状态,打开数据库,通过查询version视图也可以获取到升级后的版本信息。
执行cleanup清理环境时会删除升级过程中产生的日志文件(upgrade.log文件),如果后期需要查看,请在执行cleanup前手动保存upgrade.log文件。upgrade.log文件的存储路径是/opt/gaussdb/backup/ha_upgrade_backup/upgrade.log,其中/opt/gaussdb/backup是用户手动创建的升级过程中备份文件的存储路径。
[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.
如果数据库升级失败后,需要通过自动回滚的方式回滚数据库。
进入upgrade.py所在目录,执行下面的命令:
[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
[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
标签:ssdb 存储 图片 数据文件 value sof other inf new
原文地址:https://blog.51cto.com/candon123/2477572