gs_upgradectl

背景信息

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

升级方式为就地小版本升级。

就地小版本升级:就地升级需要停止业务进行,会一次性升级openGauss中所有节点。

注意事项

  • 升级需要停止业务。
  • openGauss运行正常且数据库节点的数据完全同步。
  • 升级过程中不允许打开kerberos开关。
  • 请不要修改安装包中解压出来的version.cfg文件。
  • 升级成功后,原归档日志文件将失效。
  • 升级成功后,原来的二进制目录将会被删除,请不要在二进制目录中存放个人数据文件。
  • 如果升级过程中出现异常导致升级失败,并且自动回滚失败时,需要用户自动执行回滚命令进行手动回滚。升级回滚成功后,升级过程中设置的GUC参数将失效。
  • 升级过程中,不允许对wal_level,max_connections,max_prepared_transactions,max_locks_per_transaction这四个GUC参数的值进行修改。
  • 数据库节点磁盘使用率低于50%时才可以执行升级操作。

语法

  • 显示帮助信息

    1. gs_upgradectl -? | --help
  • 显示版本号信息

    1. gs_upgradectl -V | --version
  • 选择升级策略

    1. gs_upgradectl -t chose-strategy [-l LOGFILE]

    gs_upgradectl - 图1 说明: 当前支持就地小版本升级。

  • 自动升级openGauss

    1. gs_upgradectl -t auto-upgrade -X XMLFILE [-l LOGFILE]
  • 自动回滚升级

    1. gs_upgradectl -t auto-rollback -X XMLFILE [-l LOGFILE] [--force]
  • 升级提交

    1. gs_upgradectl -t commit-upgrade -X XMLFILE [-l LOGFILE]

    gs_upgradectl - 图2 说明:

    • 升级提交操作只适用于openGauss的就地小版本升级。

    • 一旦提交操作完成,则不能再执行回滚操作。

参数说明

  • -t

    gs_upgradectl命令的类型。

    取值范围:chose-strategy、auto-upgrade、auto-rollback和commit-upgrade。

  • -l

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

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

    默认值:/var/log/gaussdb/用户名/om/gs_upgradectl-YYYY-MM-DD_hhmmss.log

  • -?, –help

    显示帮助信息。

  • -V, –version

    显示版本号信息。

  • -X

    指定openGauss配置文件。

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

  • –force

    当openGauss状态不正常,无法支持正常回滚回滚时,用此参数进行强制回滚操作。

示例

示例一:升级前使用新包进行前置操作。

  1. ./gs_preinstall -U roach -G users -X /data/xml/3node_3c3d_1m2s_etcd.xml
  2. Parsing the configuration file.
  3. Successfully parsed the configuration file.
  4. Installing the tools on the local node.
  5. Successfully installed the tools on the local node.
  6. Setting pssh path
  7. Successfully set core path.
  8. Distributing package.
  9. Begin to distribute package to tool path.
  10. Successfully distribute package to tool path.
  11. Begin to distribute package to package path.
  12. Successfully distribute package to package path.
  13. Successfully distributed package.
  14. Installing the tools in the cluster.
  15. Successfully installed the tools in the cluster.
  16. Checking hostname mapping.
  17. Successfully checked hostname mapping.
  18. Checking OS version.
  19. Successfully checked OS version.
  20. Creating cluster's path.
  21. Successfully created cluster's path.
  22. Setting SCTP service.
  23. Successfully set SCTP service.
  24. Set and check OS parameter.
  25. Setting OS parameters.
  26. Successfully set OS parameters.
  27. Set and check OS parameter completed.
  28. Preparing CRON service.
  29. Successfully prepared CRON service.
  30. Preparing SSH service.
  31. Successfully prepared SSH service.
  32. Setting user environmental variables.
  33. Successfully set user environmental variables.
  34. Configuring alarms on the cluster nodes.
  35. Successfully configured alarms on the cluster nodes.
  36. Setting the dynamic link library.
  37. Successfully set the dynamic link library.
  38. Setting pssh path
  39. Successfully set pssh path.
  40. Setting Cgroup.
  41. Successfully set Cgroup.
  42. Set ARM Optimization.
  43. Successfully set ARM Optimization.
  44. Preinstalling secbox.
  45. Successfully installed secbox.
  46. Setting finish flag.
  47. Successfully set finish flag.
  48. Preinstallation succeeded.

示例二:使用gs_upgradectl脚本执行升级。

  1. gs_upgradectl -t auto-upgrade -X /data/xml/3node_3c3d_1m2s_etcd.xml
  2. Static configuration matched with old static configuration files.
  3. Performing inplace rollback.
  4. Rollback succeeded.
  5. Checking upgrade environment.
  6. Successfully checked upgrade environment.
  7. Successfully checked upgrade environment.
  8. Successfully started cluster.
  9. Start to do health check.
  10. Successfully checked cluster status.
  11. Backing up current application and configurations.
  12. Successfully backed up current application and configurations.
  13. Stopping the cluster.
  14. Successfully stopped cluster.
  15. Backing up cluster configuration.
  16. Successfully backup hotpatch config file.
  17. Successfully backed up cluster configuration.
  18. Installing new binary.
  19. Restoring cluster configuration.
  20. Successfully restored cluster configuration.
  21. Modifying the socket path.
  22. Successfully modified socket path.
  23. Switch symbolic link to new binary directory.
  24. Successfully switch symbolic link to new binary directory.
  25. Successfully started cluster.
  26. Start to do health check.
  27. Successfully checked cluster status.
  28. Upgrade main process has been finished, user can do some check now.
  29. Once the check done, please execute following command to commit upgrade:
  30. gs_upgradectl -t commit-upgrade -X /data/xml/3node_3c3d_1m2s_etcd.xml

示例三:使用gs_upgradectl脚本执行自动回滚,撤销已经成功/失败的升级操作(升级回滚)。

  1. gs_upgradectl -t auto-rollback -X /data/xml/3node_3c3d_1m2s_etcd.xml
  2. Static configuration matched with old static configuration files.
  3. Performing inplace rollback.
  4. Checking static configuration files.
  5. Successfully checked static configuration files.
  6. Restoring cluster configuration.
  7. Successfully rollback hotpatch config file.
  8. Successfully restored cluster configuration.
  9. Switch symbolic link to old binary directory.
  10. Successfully switch symbolic link to old binary directory.
  11. Stopping the cluster.
  12. Successfully stopped cluster.
  13. Restoring application and configurations.
  14. Successfully restored application and configuration.
  15. Restoring cluster configuration.
  16. Successfully rollback hotpatch config file.
  17. Successfully restored cluster configuration.
  18. Successfully started cluster.
  19. Successfully cleaned new install path.
  20. Rollback succeeded.

示例四:使用gs_upgradectl脚本执行就地升级后提交(升级提交)。

  1. gs_upgradectl -t commit-upgrade -X /data/xml/3node_3c3d_1m2s_etcd.xml
  2. Old cluster app path is /data/gauss/app_e67b8bcd
  3. Successfully Cleaned old install path.
  4. Commit binary upgrade succeeded.