Gaussdb T 单机版升级示例

举报
社会主义的一块砖 发表于 2020/02/12 16:32:22 2020/02/12
【摘要】 Gaussdb T通过upgrade.py对数据库进行版本升级,本文演示将数据库从GaussDB_100_1.0.0.B019 Release 0b7bb43升级至GaussDB_100_1.0.1.SPC2.B003 Release 3ae9d6c的整个过程。1.升级前版本信息SQL> select * from v$version;VERSION ...

Gaussdb T通过upgrade.py对数据库进行版本升级,本文演示将数据库从GaussDB_100_1.0.0.B019 Release 0b7bb43升级至GaussDB_100_1.0.1.SPC2.B003 Release 3ae9d6c的整个过程。

1.升级前版本信息

SQL> select * from v$version;

VERSION                                                         
----------------------------------------------------------------
GaussDB_100_1.0.0.B019 Release 0b7bb43                          
ZENGINE                                                         
0b7bb43                                                         

3 rows fetched.

2.upgrade.py命令帮助

[omm@alldb GaussDB_100_1.0.1-DATABASE-REDHAT-64bit]$ python upgrade.py  --help

    upgrade.py is a utility to upgrade a Zengine server.

    Usage:
        python upgrade.py --help
        python upgrade.py -?
        python upgrade.py -t upgrade-type --package=path_to_package_file --backupdir=path_to_backup [--GSDB_HOME=path_to_gsdb_home] [--GSDB_DATA=path_to_data_dir] [-f cmd_config_file]
        python upgrade.py -t pretest --package=path_to_package_file --backupdir=path_to_backup [--GSDB_HOME=path_to_gsdb_home] [--GSDB_DATA=path_to_data_dir] [-f cmd_config_file] 
        python upgrade.py -t precheck --package=path_to_package_file --backupdir=path_to_backup [--GSDB_HOME=path_to_gsdb_home] [--GSDB_DATA=path_to_data_dir] [-f cmd_config_file]   
        python upgrade.py -t prepare --package=path_to_package_file --backupdir=path_to_backup [--GSDB_HOME=path_to_gsdb_home] [--GSDB_DATA=path_to_data_dir] [-f cmd_config_file]
        python upgrade.py -t replace --package=path_to_package_file --backupdir=path_to_backup [--GSDB_HOME=path_to_gsdb_home] [--GSDB_DATA=path_to_data_dir] [-f cmd_config_file]
        python upgrade.py -t start --package=path_to_package_file --backupdir=path_to_backup [--GSDB_HOME=path_to_gsdb_home] [--GSDB_DATA=path_to_data_dir] [-f cmd_config_file]
        python upgrade.py -t upgrade --package=path_to_package_file --backupdir=path_to_backup [--GSDB_HOME=path_to_gsdb_home] [--GSDB_DATA=path_to_data_dir] [-f cmd_config_file]
        python upgrade.py -t sync --package=path_to_package_file --backupdir=path_to_backup [--GSDB_HOME=path_to_gsdb_home] [--GSDB_DATA=path_to_data_dir] [-f cmd_config_file]
        python upgrade.py -t restart --package=path_to_package_file --backupdir=path_to_backup [--GSDB_HOME=path_to_gsdb_home] [--GSDB_DATA=path_to_data_dir] [-f cmd_config_file]
        python upgrade.py -t upgrade-view --package=path_to_package_file --backupdir=path_to_backup [--GSDB_HOME=path_to_gsdb_home] [--GSDB_DATA=path_to_data_dir] [-f cmd_config_file]
        python upgrade.py -t checkpoint --package=path_to_package_file --backupdir=path_to_backup [--GSDB_HOME=path_to_gsdb_home] [--GSDB_DATA=path_to_data_dir] [-f cmd_config_file]
        python upgrade.py -t dbcheck --package=path_to_package_file --backupdir=path_to_backup [--GSDB_HOME=path_to_gsdb_home] [--GSDB_DATA=path_to_data_dir] [-f cmd_config_file]
        python upgrade.py -t flush --package=path_to_package_file --backupdir=path_to_backup [--GSDB_HOME=path_to_gsdb_home] [--GSDB_DATA=path_to_data_dir] [-f cmd_config_file]
        python upgrade.py -t rollback-check --backupdir=path_to_backup [--GSDB_HOME=path_to_gsdb_home] [--GSDB_DATA=path_to_data_dir] [-f cmd_config_file]
        python upgrade.py -t rollback --backupdir=path_to_backup [--GSDB_HOME=path_to_gsdb_home] [--GSDB_DATA=path_to_data_dir] [-f cmd_config_file]
        python upgrade.py -t rollback-clean --backupdir=path_to_backup [--GSDB_HOME=path_to_gsdb_home] [--GSDB_DATA=path_to_data_dir] [-f cmd_config_file]
        python upgrade.py -s pre-check --config-file=CONFIG_FILE [--upgrade-mode=ha|single] [--packtype=run|package] [-f cmd_config_file]
        python upgrade.py -s run --config-file=CONFIG_FILE [--auto-rollback=true|false] [--upgrade-mode=ha|single] [--packtype=run|package] [-f cmd_config_file]
        python upgrade.py -s cleanup --config-file=CONFIG_FILE [--upgrade-mode=ha|single] [--packtype=run|package] [-f cmd_config_file]
        python upgrade.py -s rollback-check --config-file=CONFIG_FILE [--upgrade-mode=ha|single] [--packtype=run|package] [-f cmd_config_file]
        python upgrade.py -s rollback --config-file=CONFIG_FILE [--upgrade-mode=ha|single] [--packtype=run|package] [-f cmd_config_file]

    Common options:
        --help              show this help, then exit.
        -?                  show this help, then exit.
        -P                  input password.
        -t                  input the function that need to be executed.
        -s                  input the step for upgrade.
        --package           input the name of package containing the path.
        --backupdir         input the name of backup folder containing the path.
        --GSDB_HOME         input the name of app floder containing the path.
        --GSDB_DATA         input the name of data floder containing the path.
        --config-file       input the name of node configure file, the format is:
                            IP=pkg,app_path,backup_path,data1,data2,..
        --auto-rollback     if auto-rollback is false, will not rollback when run step failed
        --upgrade-mode      if upgrade-mode is ha, will upgrade all the nodes in the configure file
        --packtype          input upgrade package type, value scope is [run, package]
        -f                  input the config file that provide 'parameter=value'. -P, --package, --backupdir, --GSDB_HOME, --GSDB_DATA can be configed by a file.
                            in the config file, interactive=True is equal with specify '-P' parameter. 
                            for example, the config file content: 
                            GSDB_HOME=path_to_gsdb_home
                            GSDB_HOME=path_to_gsdb_home
                            backupdir=path_to_package_file
                            interactive=TRUE
    
[omm@alldb GaussDB_100_1.0.1-DATABASE-REDHAT-64bit]$

3.上传升级介质

[omm@alldb ~]$ mkdir -p /opt/software/upgrade
[omm@alldb ~]$ cd /opt/software/upgrade
[omm@alldb upgrade]$ tar -zxvf GaussDB_100_1.0.1-DATABASE-REDHAT-64bit.tar.gz 
GaussDB_100_1.0.1-DATABASE-REDHAT-64bit/
GaussDB_100_1.0.1-DATABASE-REDHAT-64bit/sshexkey.py
GaussDB_100_1.0.1-DATABASE-REDHAT-64bit/upgrade.py
GaussDB_100_1.0.1-DATABASE-REDHAT-64bit/funclib.py
GaussDB_100_1.0.1-DATABASE-REDHAT-64bit/install.py
GaussDB_100_1.0.1-DATABASE-REDHAT-64bit/GaussDB_100_1.0.1-RUN-REDHAT-64bit.sha256
GaussDB_100_1.0.1-DATABASE-REDHAT-64bit/GaussDB_100_1.0.1-RUN-REDHAT-64bit.tar.gz

4.生成升级配置文件

配置文件说明:IP=升级包路径,Gausdb HOME目录,备份目录,数据目录。

[omm@alldb upgrade]$ vi config_file.ini 
192.168.2.88=/opt/software/upgrade/GaussDB_100_1.0.1-DATABASE-REDHAT-64bit.tar.gz,/opt/gaussdb/app,/opt/gaussdb/backup,/opt/gaussdb/data

5.升级前检查

升级前,请确保数据库在运行。

检查命令:

python upgrade.py -s pre-check --config-file=/opt/software/upgrade/config_file.ini  --upgrade-mode=single

检查日志:

[omm@alldb GaussDB_100_1.0.1-DATABASE-REDHAT-64bit]$ python upgrade.py -s pre-check --config-file=/opt/software/upgrade/config_file.ini  --upgrade-mode=single
Begin to precheck for single upgrade.
Old version: 1.0.0.B019 New version: 1.0.1.SPC2.B003.
Precheck for single upgrade finished.
Upgrade [pre-check] step successfully.

6.执行升级

升级命令:

python upgrade.py -s run --config-file=/opt/software/upgrade/config_file.ini --upgrade-mode=single

升级日志:

[omm@alldb GaussDB_100_1.0.1-DATABASE-REDHAT-64bit]$ python upgrade.py -s run --config-file=/opt/software/upgrade/config_file.ini --upgrade-mode=single
Old version: 1.0.0.B019 New version: 1.0.1.SPC2.B003.
Precheck step for single upgrade.
Prepare step for single upgrade.
Replace step for single upgrade.
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.

7.升级后检查

[omm@alldb ~]$ cd $GSDB_HOME/bin
[omm@alldb bin]$ 
[omm@alldb bin]$ python zctl.py -t start
Successfully started instance.



[omm@alldb bin]$ zsql / as sysdba -q

connected.


SQL>  select * from v$version;

VERSION                                                         
----------------------------------------------------------------
GaussDB_100_1.0.1.SPC2.B003 Release 3ae9d6c                     
ZENGINE                                                         
3ae9d6c                                                         

3 rows fetched.

8.升级成功后环境清理

清理命令:

python upgrade.py -s cleanup --config-file=/opt/software/upgrade/config_file.ini --upgrade-mode=single

清理日志:

[omm@alldb GaussDB_100_1.0.1-DATABASE-REDHAT-64bit]$ python upgrade.py -s cleanup --config-file=/opt/software/upgrade/config_file.ini --upgrade-mode=single
clean backup and tmp files.
Upgrade [cleanup] step successfully.


转自墨天轮

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。