暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

华为GaussDB T gs_upgradectl

墨天轮 2019-09-28
432

gs_upgradectl

用户会根据GaussDB 100提供的新特性,确定是否对现有系统进行升级。

背景信息

如果升级过程中出现异常导致升级失败,并且自动回滚失败时,需要用户自动执行回滚命令进行手动回滚。

注意事项

  • 暂不支持用户进行升级操作,升级前请联系技术支持。
  • 仅支持离线升级。
  • 当前升级支持二进制升级和小版本升级。
  • 仅支持从低版本往高版本升级。
  • 不支持跨C版本升级,若存在跨C版本升级需求,需逐版本执行升级操作。
  • 升级前请停止所有业务。
  • 集群运行正常且主DN的数据完全同步到备DN。
  • 升级操作不能和主机替换、扩容同时执行。不支持虚拟IP。
  • 升级前需要在目标安装包解压出的script目录下执行前置脚本gs_preinstall。
  • 小版本升级时,不支持对部署GTS组件的集群进行升级。
  • 二进制升级后,未执行commit-upgrade进行升级提交的情况下仍可以执行回滚操作,如果验证确认升级成功后,可以执行commit-upgrade命令以删除升级临时文件。
  • 小版本升级最后,如果CN和DN均处于READ ONLY模式下,则可以执行回滚;如果CN或主DN处于READ WRITE模式,则不可执行回滚。其中,CN、DN的模式可通过查询DV_DATABASE的OPEN_STATUS字段获取。如果验证确认升级成功,可以执行commit-upgrade命令以删除升级临时文件。
  • 升级命令执行成功后,如果已执行commit-upgrade命令进行升级提交,则无法再通过调用回滚接口auto-rollback或binary-rollback、systable-rollback回退到老版本。

语法

  • 选择升级策略
    gs_upgradectl -t upgrade-type -X XMLFILE [-l LOGFILE]
  • 自动升级集群
    gs_upgradectl -t auto-upgrade -X XMLFILE [-l LOGFILE]
  • 自动回滚集群
    gs_upgradectl -t auto-rollback -X XMLFILE [-l LOGFILE]
  • 二进制升级集群
    gs_upgradectl -t binary-upgrade -X XMLFILE [-l LOGFILE]
  • 二进制回滚集群
    gs_upgradectl -t binary-rollback -X XMLFILE [-l LOGFILE]
  • 小版本升级集群
    gs_upgradectl -t systable-upgrade -X XMLFILE [-l LOGFILE]
  • 小版本升级回滚
    gs_upgradectl -t systable-rollback -X XMLFILE [-l LOGFILE]
  • 升级提交
    gs_upgradectl -t commit-upgrade -X XMLFILE [-l LOGFILE]
  • 显示帮助信息
    gs_upgradectl -? | --help
  • 显示版本号信息
    gs_upgradectl -V | --version

参数说明

gs_upgradectl参数可以分为如下几类:
  • 通用参数:
    • -t

      gs_upgradectl命令的类型。

      取值范围:upgrade-type、auto-upgrade、auto-rollback、binary-upgrade、binary-rollback、systable-upgrade、systable-rollback和commit-upgrade。

    • -l

      用于记录升级或回滚过程中的日志信息。

      取值范围:任意存在的可访问的绝对路径。

      默认值:$GAUSSLOG/om/gs_upgradectl-YYYY-MM-DD_hhmmss.log

    • -?,--help

      显示帮助信息。

    • -V,--version

      显示版本号信息。

  • 升级参数:
    • -X

      指定集群配置文件。

      取值范围:xml文档的存储路径。

示例

  • 使用gs_upgradectl脚本执行自动升级(以判断结果为小版本升级为例)。
    omm@plat1:/opt/software/gaussdb/script> gs_upgradectl -t auto-upgrade -X /opt/software/gaussdb/ClusterConfig.xml Performing systable-upgrade. Performing rollback. No need to rollback. Checking cluster health. Successfully checked cluster health. Checking database status. Successfully checked database status. Switching redo log file for primary dn. Successfully switch redo log for primary dn. Checking LSN for dns. Successfully checking LSN for dns. Deleting archive_log for dns. Successfully Deleted archive_log for dns. Generating upgrade sql file. Successfully generated upgrade sql file. Generating combined upgrade sql file. Successfully generated combined upgrade sql file. Backing up current application and configurations. Successfully backed up current application and configurations. Saving system tabls path. Successfully saved system tables path. Saving redo log file path. Successfully saved redolog file path. Saving undo log file path. Successfully saved redolog file path. Stopping the cluster. Successfully stopped the cluster. Starting all dns to open status for backuping system ctrl and redolog. Successfully started all dns to open status for backuping system ctrl and redolog. Backing up current system tables. Successfully backed up system tables. Backing up current ctrl files. Successfully backed up ctrl files. Backing up current redolog files. Successfully backed up redolog files. Backing up current undolog files. Successfully backed up undolog files. Backing up current kudu. Successfully backed up kudu. Shutdowning all dns for backuping system ctrl and redolog. Successfully shutdown all dns for backuping system ctrl and redolog. Starting the primary dn to open status for covering ctrl and redolog. Successfully started the primary dn to open status for covering ctrl and redolog. Shuting down the primary dn for covering ctrl and redolog. Successfully shutdowned the primary dn to open status for covering ctrl and redolog. Upgrading application. Successfully upgraded application. Starting the restricted mode cluster. Successfully started the restricted mode cluster. Upgrading the system table Successfully upgraded the system table Shutting down the restricted mode cluster Successfully shut down the restricted mode cluster Starting the dns to open status. Successfully started the dns to open status. Shutting down the open status dns. Successfully shutted down the open status dns. Starting the etcd. Successfully started the etcd. Loading the json. Successfully loaded the json. Starting cm agent. Successfully started cm agent. Starting the cluster. Successfully started the cluster. 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/gaussdb/clusterconfig.xml Time for "UpgradeCheck" : 29.3515 seconds Time for "UpgradeBackup" : 19.7635 seconds Time for "UpgradeStopCluster" : 23.9331 seconds Time for "UpgradeBackupSysCtrlRedo" : 73.8159 seconds Time for "UpgradeCoverCtrlRedo" : 81.3543 seconds Time for "Upgrade" : 3.9485 seconds Time for "KernelUpgrade" : 103.603 seconds Time for "ShutdownRestrict" : 13.0126 seconds Time for "StartOpen" : 16.2596 seconds Time for "ShutdownOpen" : 8.4706 seconds Time for "SystemTable" : 291.2652 seconds Time for "UpgradeStartCluster" : 88.7027 seconds Time for "Total" : 628.4768 seconds
  • 使用gs_upgradectl脚本执行二进制升级。
    omm@plat1:~> gs_upgradectl -t binary-upgrade -X /opt/software/gaussdb/clusterconfig.xml Performing binary upgrade. Performing rollback. No need to rollback. Checking cluster health. Successfully checked cluster health. Backing up current application and configurations. Successfully backed up current application and configurations. Stopping the cluster. Successfully stopped the cluster. Upgrading application. Successfully upgraded application. Starting the etcd. Successfully started the etcd. Loading the json. Successfully loaded the json. Starting cm agent. Successfully started cm agent. Starting the cluster. Successfully started the cluster. 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 /home/xml/green_3c1d2s.xml Time for "UpgradeCheck" : 0.5707 seconds Time for "UpgradeBackup" : 15.3427 seconds Time for "UpgradeStopCluster" : 16.7897 seconds Time for "Upgrade" : 4.3377 seconds Time for "UpgradeStartCluster" : 66.1169 seconds Time for "Total" : 116.0948 seconds
  • 使用gs_upgradectl脚本执行小版本升级。
    omm@plat1:~> gs_upgradectl -t systable-upgrade -X /opt/software/gaussdb/clusterconfig.xml Performing systable-upgrade Performing rollback. No need to rollback. Checking cluster health. Successfully checked cluster health. Checking database status. Successfully checked database status. Switching redo log file for primary dn. Successfully switch redo log for primary dn. Checking LSN for dns. Successfully checking LSN for dns. Deleting archive_log for dns. Successfully Deleted archive_log for dns. Generating upgrade sql file. Successfully generated upgrade sql file. Generating combined upgrade sql file. Successfully generated combined upgrade sql file. Backing up current application and configurations. Successfully backed up current application and configurations. Saving system tabls path. Successfully saved system tables path. Saving redo log file path. Successfully saved redolog file path. Saving undo log file path. Successfully saved redolog file path. Stopping the cluster. Successfully stopped the cluster. Starting all dns to open status for backuping system ctrl and redolog. Successfully started all dns to open status for backuping system ctrl and redolog. Backing up current system tables. Successfully backed up system tables. Backing up current ctrl files. Successfully backed up ctrl files. Backing up current redolog files. Successfully backed up redolog files. Backing up current undolog files. Successfully backed up undolog files. Backing up current kudu. Successfully backed up kudu. Shutdowning all dns for backuping system ctrl and redolog. Successfully shutdown all dns for backuping system ctrl and redolog. Starting the primary dn to open status for covering ctrl and redolog. Successfully started the primary dn to open status for covering ctrl and redolog. Shuting down the primary dn for covering ctrl and redolog. Successfully shutdowned the primary dn to open status for covering ctrl and redolog. Upgrading application. Successfully upgraded application. Starting the restricted mode cluster. Successfully started the restricted mode cluster. Upgrading the system table Successfully upgraded the system table Shutting down the restricted mode cluster Successfully shut down the restricted mode cluster Starting the dns to open status. Successfully started the dns to open status. Shutting down the open status dns. Successfully shutted down the open status dns. Starting the etcd. Successfully started the etcd. Loading the json. Successfully loaded the json. Starting cm agent. Successfully started cm agent. Starting the cluster. Successfully started the cluster. 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/gaussdb/clusterconfig.xml Time for "UpgradeCheck" : 29.3515 seconds Time for "UpgradeBackup" : 19.7635 seconds Time for "UpgradeStopCluster" : 23.9331 seconds Time for "UpgradeBackupSysCtrlRedo" : 73.8159 seconds Time for "UpgradeCoverCtrlRedo" : 81.3543 seconds Time for "Upgrade" : 3.9485 seconds Time for "KernelUpgrade" : 103.603 seconds Time for "ShutdownRestrict" : 13.0126 seconds Time for "StartOpen" : 16.2596 seconds Time for "ShutdownOpen" : 8.4706 seconds Time for "SystemTable" : 291.2652 seconds Time for "UpgradeStartCluster" : 88.7027 seconds Time for "Total" : 628.4768 seconds
  • 使用gs_upgradectl脚本执行自动升级失败手动回滚。

    以二进制升级的回滚为例。

    omm@plat1:/opt/software/gaussdb/script> gs_upgradectl -t auto-rollback -X /opt/software/gaussdb/ClusterConfig.xml Performing rollback. Restoring application and configurations. Successfully restored application and configuration. Restoring cluster configuration. Successfully restored cluster configuration. Restarting the ETCD. Successfully restarted the ETCD. Loading the configuration file. Successfully loaded the configuration file. Starting the cluster. Successfully started the cluster. Rollback succeeded.
  • 使用gs_upgradectl脚本执行小版本升级失败后回滚。
    omm@plat1:/opt/software/gaussdb/script> gs_upgradectl -t systable-rollback -X /opt/software/gaussdb/ClusterConfig.xml Performing rollback. Rollbacking for systable upgrade. Successfully rollbacked for systable upgrade. Restoring application and configurations. Successfully restored application and configuration. Shuting down the primary dn for covering ctrl and redolog. Successfully shutdowned the primary dn to open status for covering ctrl and redolog. Shutdowning all dns before restoring system ctrl and redolog. Shutdowning all dns before restoring system ctrl and redolog. Rollbacking for cntl, redolog and undolog. Successfully rollbacked for cntl, redolog and undolog. Rollbacking for kudu. Successfully rollbacked for kudu. Starting all dns to open status after restoring system ctrl and redolog. Successfully started all dns to open status after restoring system ctrl and redolog. Shutdowning all dns after restoring system ctrl and redolog. Successfully shutdown all dns after restoring system ctrl and redolog. Shuting down the primary dn for covering ctrl and redolog. Successfully shutdowned the primary dn to open status for covering ctrl and redolog. Shutdowning all dns for backuping system ctrl and redolog. Successfully shutdown all dns for backuping system ctrl and redolog. Restarting the ETCD. Successfully restarted the ETCD. Loading the configuration file. Successfully loaded the configuration file. Starting the cluster. Successfully started the cluster. Rollback succeeded.
  • 使用gs_upgradectl脚本执行升级提交。
    omm@plat1:/opt/software/gaussdb/script> gs_upgradectl -t commit-upgrade -X /opt/software/gaussdb/ClusterConfig.xml Commit systable-upgrade succeeded.
    omm@plat1:/opt/software/gaussdb/script> gs_upgradectl -t commit-upgrade -X /opt/software/gaussdb/ClusterConfig.xml Commit binary-upgrade succeeded.
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论