卸载openGauss

卸载openGauss的过程包含卸载openGauss和对openGauss服务器的环境做清理。

执行卸载

openGauss提供了卸载脚本帮助用户完整的卸载openGauss。

操作步骤

  1. 以操作系统用户omm登录数据库主节点。

  2. 使用gs_uninstall卸载openGauss。

    1. gs_uninstall --delete-data

    或者在openGauss中每个节点执行本地卸载。

    1. gs_uninstall --delete-data -L

示例

使用gs_uninstall脚本进行卸载openGauss。

  1. gs_uninstall --delete-data
  2. Checking uninstallation.
  3. Successfully checked uninstallation.
  4. Stopping the cluster.
  5. Successfully stopped the cluster.
  6. Successfully deleted instances.
  7. Uninstalling application.
  8. Successfully uninstalled application.
  9. Uninstallation succeeded.

单机卸载场景使用gs_uninstall脚本进行卸载。

  1. gs_uninstall --delete-data
  2. Checking uninstallation.
  3. Successfully checked uninstallation.
  4. Stopping the cluster.
  5. Successfully stopped the cluster.
  6. Successfully deleted instances.
  7. Uninstalling application.
  8. Successfully uninstalled application.
  9. Uninstallation succeeded.

错误排查

如果卸载失败请根据“$GAUSSLOG/om/gs_uninstall-YYYY-MM-DD_HHMMSS.log”中的日志信息排查错误。

一键式环境清理

在openGauss卸载完成后,如果不需要在环境上重新部署openGauss,可以运行脚本gs_postuninstall对openGauss服务器上环境信息做清理。openGauss环境清理是对环境准备脚本gs_preinstall所做设置的清理。

前提条件

  • openGauss卸载执行成功。
  • root用户互信可用。
  • 只能使用root用户执行gs_postuninstall命令。

操作步骤

  1. 以root用户登录openGauss服务器。

  2. 查看root用户互信是否建立,如果root用户没有建立互信,需要手工建立root用户互信,操作请参考手工建立互信

    查看互信是否建成功,可以互相ssh主机名。输入exit退出。

    1. plat1:~ # ssh plat2
    2. Last login: Tue Jan 5 10:28:18 2016 from plat1
    3. Huawei's internal systems must only be used for conducting Huawei's business or for purposes authorized by Huawei management.Use is subject to audit at any time by Huawei management.
    4. plat2:~ # exit
    5. logout
    6. Connection to plat2 closed.
    7. plat1:~ #
  3. 进入script路径下。

    1. cd /opt/software/openGauss/script
  4. 使用gs_postuninstall进行清理。若为环境变量分离的模式安装的数据库需要source环境变量分离文件ENVFILE。

    1. ./gs_postuninstall -U omm -X /opt/software/openGauss/cluster_config.xml --delete-user --delete-group

    或者在openGauss中每个节点执行本地后置清理。

    1. ./gs_postuninstall -U omm -X /opt/software/openGauss/cluster_config.xml --delete-user --delete-group -L

    omm为运行openGauss的操作系统用户名,/opt/software/openGauss/cluster_config.xml为openGauss配置文件路径。

    若为环境变量分离的模式安装的数据库需删除之前source的环境变量分离的env参数。

    1. unset MPPDB\_ENV\_SEPARATE\_PATH
  5. 删除openGauss数据库各节点root用户的互信,操作参考手工建立互信的删除root用户互信部分内容。

  6. 注销root用户。

示例

清理主机的环境。

  1. gs_postuninstall -U omm -X /opt/software/openGauss/cluster_config.xml --delete-user
  2. Parsing the configuration file.
  3. Successfully parsed the configuration file.
  4. Check log file path.
  5. Successfully checked log file path.
  6. Checking unpreinstallation.
  7. Successfully checked unpreinstallation.
  8. Deleting Cgroup.
  9. Successfully deleted Cgroup.
  10. Deleting the instance's directory.
  11. Successfully deleted the instance's directory.
  12. Deleting the installation directory.
  13. Successfully deleted the installation directory.
  14. Deleting the temporary directory.
  15. Successfully deleted the temporary directory.
  16. Deleting remote OS user.
  17. Successfully deleted remote OS user.
  18. Deleting software packages and environmental variables of other nodes.
  19. Successfully deleted software packages and environmental variables of other nodes.
  20. Deleting logs of other nodes.
  21. Successfully deleted logs of other nodes.
  22. Deleting software packages and environmental variables of the local node.
  23. Successfully deleted software packages and environmental variables of the local nodes.
  24. Deleting local OS user.
  25. Successfully deleted local OS user.
  26. Deleting local node's logs.
  27. Successfully deleted local node's logs.
  28. Successfully cleaned environment.

错误排查

如果一键式环境清理失败请根据“$GAUSSLOG/om/gs_postuninstall-YYYY-MM-DD_HHMMSS.log”中的日志信息排查错误。