VastbaseG100

基于openGauss内核开发的企业级关系型数据库。

Menu

新版本升级

本方法适用于Vastbase G100 V2.2 Build 5 中补丁号(Patch)大于或等于75的数据库版本升级。

升级前请先备份数据。参考备份与恢复指南

升级前准备

设置免密登录

前置步骤 修改PermitRootLogin配置,允许用户远程登录。

vi /etc/ssh/sshd_config
  • 方法一:注释PermitRootLogin on。

    #PermitRootLogin on
    
  • 方法二:修改PermitRootLogin为yes。

    PermitRootLogin yes 
    

步骤1 以root用户登录操作系统。

步骤2 执行如下命令,为ssh生成、管理和转换认证密钥。

ssh-keygen

连续回车,显示如下结果,表示成功。

The key's randomart image is:
+---[RSA 2048]----+
|   . oB ..o   o. |
|    oo.= + . +   |
|  . .o  = . +    |
| o .  .=E+ .     |
| o++.+ooS o .    |
|. Oo=.+= o o     |
| + o  ..+ =      |
|         * .     |
|          .      |
+----[SHA256]-----+

步骤3 执行ssh-copy-id -i ~/.ssh/id_rsa.pub 数据库安装用户@配置中的主机地址,实现免密登录。以数据库安装用户为vbinstall为例。

ssh-copy-id -i ~/.ssh/id_rsa.pub vbinstall@master

修改GUC参数配置文件(可选)

  • 若license_path使用默认路径(/etc/vastbase/.license),可跳过这一步。

  • 若升级前数据库版本为Vastbase G100 V2.2 Build 5(Patch No.73)及以后,可跳过这一步。

步骤1 以root用户登录操作系统。

步骤2 ,修改cluster_guc.conf配置文件,在配置项[coordinator/datanode]末尾添加以下内容。

1、进入数据库安装目录下的bin目录,编辑cluster_guc.conf配置文件。

vi $GAUSSHOME/bin/cluster_guc.conf

2、在配置项[coordinator/datanode]末尾添加以下内容:

若license_path使用默认路径(/etc/vastbase/.license),最后一行license_path相关内容可不添加。

vastbase_login_info|bool|0,0|NULL|NULL|
recovery_parallelism|int|1,2147483647|NULL|NULL|
audit_operation_result|int|0,2|NULL|NULL|
license_path|string|0,0|NULL|NULL|

3、保存退出。

:wq

调整配置文件

步骤1 以root用户登录操作系统。

步骤2 切换到数据库安装用户,以vbinstall为例。

su - vbinstall

步骤3 进入数据库安装目录,对比vastbase -V回显结果来修改version.cfg和upgrade_version文件。

如果内核版本号是92.298,在以上两个配置文件中需手动将内核版本号修改为92.299。

vastbase -V

以如下版本Vastbase G100为例,执行上述语句返回结果为:

vastbase (Vastbase G100 V2.2 (Build 5.80.4878)) compiled at 2022-01-17 18:01:44 commit 0 last mr  debug

对照vastbase -V返回信息,按照下图方式修改两个配置文件:

修改参数

步骤1 以root用户登录操作系统。

步骤2 修改postgresql.conf配置文件配置参数vastbase_login_info=off

1、编辑配置文件postgresql.conf。

vi $PGDATA/postgresql.conf

2、设置参数。

vastbase_login_info=off

3、保存退出。

:wq

上传安装包和配置文件

步骤1 以root用户登录操作系统。

步骤2 创建新包目录,并修改新包目录权限为755。上传安装包到该目录下:

mkdir -p /opt/software/vastbase
chmod 755 /opt
chmod 755 /opt/software
chmod 755 /opt/software/vastbase

步骤3 解压安装包(安装包名称以Vastbase****tar.gz为例,请根据实际情况替换)。

cd  /opt/software/vastbase
tar xf Vastbase****tar.gz

步骤4 创建vastbase目录,继续解压安装包到该目录中,得到OM工具包。

mkdir /opt/software/vastbase/vastbase
cd vastbase-installer
tar xf Vastbase****tar.gz -C /opt/software/vastbase/vastbase

步骤5 解压OM工具包(OM包名称以Vastbase-G100****om.tar.gz为例,请根据实际情况替换),OM工具包解压后自动在script目录生成gs_upgradectl等脚本工具。

cd /opt/software/vastbase/vastbase
tar xf Vastbase-G100...om.tar.gz

步骤6 修改配置文件模板,修改后将文件所属用户修改为数据库安装用户。

配置文件模板为位于$GAUSSHOME/etc/om的cluster_config.xml文件,将其拷贝到/opt/software/vastbase目录后修改。

chown vbinstall:vbinstall cluster_config.xml

准备升级

执行gs_preinstall准备升级

步骤1 以root用户登录操作系统。

步骤2 进入script目录,执行准备升级命令,期间输入yes:

cd /opt/software/vastbase/vastbase/script/
./gs_preinstall -U vbinstall -G vbinstall -X /opt/software/vastbase/cluster_config.xml
  • -U:指定数据库安装用户,后跟数据库安装用户名。
  • -G:指定数据库安装用户所属的组,后跟数据库安装用户所属的组名。
  • -X:指定配置文件,后跟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 pssh path
Successfully set core path.
Are you sure you want to create the user[vastbase] and create trust for it (yes/no)?
 yes
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 "/soft/vb/2.2.5.120/vastbase-installer/script/gs_checkos -i A -h vb-up-test --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.
Set ARM Optimization.
No need to set ARM Optimization.
Fixing server package owner.
Setting finish flag.
Successfully set finish flag.
Preinstallation succeeded.

执行升级

执行gs_upgradectl进行

步骤1 以root用户登录操作系统。

步骤2 切换到数据库安装用户。

su - vbinstall

步骤3 生成升级中所用到的配置文件。

gs_om -t generateconf -X /opt/software/vastbase/cluster_config.xml --distribute

步骤4 配置OM_GAUSSLOG环境变量,修改文件.Vastbase和.bashrc,将OM_GAUSSLOG的值修改成cluster_config.xml配置文件中gaussdbLogPath的值。

步骤5 停止数据库。

vb_ctl stop

步骤6 重新以root用户登录操作系统。

步骤7 执行升级命令gs_upgradectl进行升级。

gs_upgradectl -t auto-upgrade -X /opt/software/vastbase/cluster_config.xml

执行结果如下表示成功:

The requster's hostname: vb-up-test, IP: 192.168.100.201, mac address:00:0c:29:8f:38:6d
The application is Vastbase G100
Static configuration matched with old static configuration files.
Performing inplace rollback.
Rollback succeeded.
Checking upgrade environment.
Successfully checked upgrade environment.
Successfully started cluster.
Start to do health check.
Successfully checked cluster status.
Backing up current application and configurations.
Successfully backed up current application and configurations.
Backing up cluster configuration.
Successfully backup hotpatch config file.
Successfully backed up cluster configuration.
Installing new binary.
Restoring cluster configuration.
Successfully restored cluster configuration.
Successfully started cluster.
Successfully started cluster.
47154207554752:error:0200100D:system library:fopen:Permission denied:crypto/bio/bss_file.c:69:fopen('/root/dependency/openssl/openssl/openssl.cnf','rb')
47552293625024:error:0200100D:system library:fopen:Permission denied:crypto/bio/bss_file.c:69:fopen('/root/dependency/openssl/openssl/openssl.cnf','rb')
47769733770432:error:0200100D:system library:fopen:Permission denied:crypto/bio/bss_file.c:69:fopen('/root/dependency/openssl/openssl/openssl.cnf','rb')
Switch symbolic link to new binary directory.
Successfully switch symbolic link to new binary directory.
Successfully started cluster.
Successfully started cluster.
Waiting for the cluster status to become normal.
.
The cluster status is normal.
Start to do health check.
Successfully checked cluster status.
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 /soft/vb/cluster_config.xml 

以上报错对升级暂无影响,无需关注。

步骤8 切换到数据库安装用户,执行如下命令验证升级后版本和查看状态以及被升级的功能可正常使用。

su - vbinstall
vastbase --version
gs_om -t status

数据库升级操作回滚

步骤1 执行如下命令,完成数据库回滚。

gs_upgradectl -t auto-rollback -X /opt/software/vastbase/cluster_config.xml

执行结果如下:

Performing inplace rollback.
Checking static configuration files.
Successfully checked static configuration files.
Successfully started cluster.
Restoring application and configurations.
Successfully restored application and configuration.
Restoring cluster configuration.
Successfully rollback hotpatch config file.
Successfully restored cluster configuration.
Clean up backup catalog files.
Successfully started cluster.
Successfully cleaned new install path.
Rollback succeeded.

步骤2 回滚验证,切换到数据库安装用户,执行如下命令查看是否为升级前的版本、查看数据库当前状态是否正确以及检查被回滚的功能恢复到升级之前的状态。

su - vbinstall
vastbase --version
gs_om -t status

提交数据库升级操作

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

执行结果如下:

Clean up backup catalog files.
Successfully cleaned old install path.
Successfully started cluster.
Commit binary upgrade succeeded.

提交升级后将无法回滚。