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

华为openGauss gs_om

华为高斯 2020-06-01
4273

背景信息

openGauss提供了gs_om工具帮助对openGauss进行维护,包括启动openGauss、停止openGauss、查询openGauss状态、查询静态配置、查询openGauss状态、生成静态配置文件、生成动态配置文件、SSL证书替换、显示帮助信息和显示版本号信息等功能。

前提条件

需以操作系统用户omm执行gs_om命令。

语法

  • 启动openGauss

    gs_om -t start [-h HOSTNAME] [-D dataDir] [--time-out=SECS] [--security-mode=MODE] [-l LOGFILE]

  • 停止openGauss

    gs_om -t stop [-h HOSTNAME] [-D dataDir] [--time-out=SECS] [-m MODE] [-l LOGFILE]

  • 查询openGauss状态

    gs_om -t status [-h HOSTNAME] [-o OUTPUT] [--detail] [--all] [-l LOGFILE]

  • 生成静态配置文件

    gs_om -t generateconf -X XMLFILE [--distribute] [-l LOGFILE]

  • 生成动态配置文件,备机切换成主机后,需要执行此操作

    gs_om -t refreshconf

  • 查看静态配置

    gs_om -t view [-o OUTPUT]

  • 查询openGauss状态

    gs_om -t query [-o OUTPUT]

  • SSL证书替换

    gs_om -t cert --cert-file=CERTFILE [-l LOGFILE] gs_om -t cert --rollback

  • 显示帮助信息

    gs_om -? | --help

  • 显示版本号信息

    gs_om -V | --version

参数说明

gs_om参数可以分为如下几类:

  • 通用参数:

    • -t

      gs_om命令的类型。

      取值范围:start、stop、status、generateconf、cert、view、query、refreshconf、kerberos。

    • -l

      指定日志文件及存放路径。

      默认值:$GAUSSLOG/om/gs_om-YYYY-MM-DD_hhmmss.log(virtualip的默认值:/tmp/gs_virtualip/gs_om-YYYY-MM-DD_hhmmss.log)

    • -?, --help

      显示帮助信息。

    • -V, --version

      显示版本号信息。

  • 启动openGauss参数:

    • -h

      指定需要启动的服务器名称。一次只能启动一个服务器。

      取值范围:服务器名称。

      不指定服务器名称时,表示启动openGauss。

    • -D

      指定 dn路径

      取值范围:dn路径

      不指定dn路径,表示使用静态文件中的dn路径

    • --time-out=SECS

      指定超时时间,如果超时,om脚本自动退出。单位:s。

      取值范围:正整数,建议值300。

      默认值:300

    • --security-mode

      指定是否以安全模式启动数据库

      取值范围:on 已安全模式启动, off 不已安全模式启动

      默认不开启安全模式

  • 停止openGauss参数:

    • -h

      指定需要停止实例所在的服务器名称。一次只能停止一个服务器。

      取值范围:实例所在的服务器名称。

      不指定服务器名称时,表示停止openGauss。

    • -m, --mode=MODE

      停止模式设置。

      取值范围:支持三种停止模式。

      • fast方式:保证有主备关系的实例数据是一致的。
      • immediate方式:不保证有主备关系的实例数据是一致的。
      • smart方式:保证有主备关系的实例数据是一致的,且备机本地所有日志都已redo。

      默认值:fast方式。

    • --time-out=SECS

      指定超时时间,如果超时,om脚本自动退出。单位:s。

      取值范围:正整数,建议值300。

      默认值:300

  • 查询状态参数:

    openGauss状态显示结果的参数说明请参见表1

    • -h

      指定需要待查询的服务器名称。

      取值范围:服务器名称。

      不指定服务器时,表示查询openGauss。

    • -o

      输出到指定的output文件中。

      如果不指定,直接显示在屏幕上。

    • --detail

      显示详细信息。如果不指定,只提示该服务器是否正常。

      --all

      显示openGauss所有节点信息

  • 生成配置文件参数:

    • -X

      选择openGauss配置文件路径。

      取值范围:clusterconfig.xml的路径。

    • --distribute

      将静态配置文件发布到openGauss实例的安装目录。

  • SSL证书替换:

    • --cert-file

      指定本地SSL证书zip压缩包所在路径。

      --rollback

      证书回退到上一次成功备份的状态。

表 1 状态说明

字段

字段含义

字段值

cluster_state

openGauss状态。显示openGauss是否运行正常。

  • Normal:表示openGauss可用,且数据有冗余备份。所有进程都在运行,主备关系正常。
  • Unavailable:表示openGauss不可用。
  • Degraded:表示openGauss可用,但数据没有冗余备份。

redistributing

数据重分布状态

  • Yes:表示openGauss处于数据重分布状态。
  • No:表示openGauss未处于数据重分步状态。

balanced

平衡状态。显示是否有openGauss实例发生过主备切换而导致主机负载不均衡。

  • Yes:表示openGauss处于负载均衡状态。
  • No:表示openGauss未处于负载均衡状态。

node

主机名称

表示该实例所在的主机名称。多AZ时会显示AZ编号。

node_ip

主机IP

表示该实例所在的主机IP。

instance

实例ID

表示该实例的ID。

state

实例状态

  • Primary:表示实例为主实例。
  • Standby:表示实例为备实例。
  • Secondary:表示实例为从备实例。
  • Pending:表示该实例在仲裁阶段。
  • Unknown:表示实例状态未知。
  • Down:表示实例处于宕机状态。

表 2 特性ID说明

特性名称

特性ID

openGauss产品

多值列

0

基础版

JSON

1

不支持License控制

XML

2

不支持

数据存储格式ORC

3

基础版

单机支持一主多备,备机可读

5

策略不放开

多维碰撞分析GPU加速

7

高级特性

全文索引

8

基础版

EXTENSION_CONNECTOR

9

基础版

EXPRESS_CLUSTER

12

高级版

跨DC协同

13

高级版

14

不支持

时序

15

不支持

PostGis对接

16

基础版

openGauss内高可用-一主多备

17

策略不放开

行级权限控制

18

高级版

透明加密

19

高级版

私有表

20

高级版

示例

  • 启动openGauss。

    ``` gs_om -t start Starting cluster. ====================================================================== . ======================================================================

    Successfully started . ```

  • 停止openGauss。

    gs_om -t stop Stopping cluster. ========================================= Successfully stopped cluster. ========================================= End stop cluster.

  • 查看openGauss详细状态信息,含实例状态信息。

    ``` gs_om -t status --detail [ Cluster State ]

    cluster_state : Normal redistributing : No

    [ Datanode State ] node node_ip instance state | node node_ip instance state | node node_ip instance state


    ```

  • 在openGauss上执行如下命令,生成配置文件。

    gs_om -t generateconf -X /opt/software/openGauss/clusterconfig.xml --distribute Generating static configuration files for all nodes. Creating temp directory to store static configuration files. Successfully created the temp directory. Generating static configuration files. Successfully generated static configuration files. Static configuration files for all nodes are saved in /opt/huawei/Bigdata/gaussdb/wisequery/script/static_config_files. Distributing static configuration files to all nodes. Successfully distributed static configuration files.

    然后打开生成的配置文件目录,会看到新生成的3个文件。

    cd /opt/huawei/Bigdata/gaussdb/wisequery/script/static_config_files ll total 456 -rwxr-xr-x 1 omm dbgrp 155648 2016-07-13 15:51 cluster_static_config_plat1 -rwxr-xr-x 1 omm dbgrp 155648 2016-07-13 15:51 cluster_static_config_plat2 -rwxr-xr-x 1 omm dbgrp 155648 2016-07-13 15:51 cluster_static_config_plat3

  • SSL证书回退。

    gs_om -t cert --rollback [plat1] SSL cert files rollback successfully. [plat2] SSL cert files rollback successfully. [plat3] SSL cert files rollback successfully.

  • 新License注册

    gs_om -t license -m register -f MTgsMTkK Preparing for the program initialization. Lock the OPS operation of OM components. Check and make sure the consistency of the license file. Backup the license file on all of the cluster hosts. Encrypt the product feature information and generate the license file. Send message to the 数据库节点 instances to reload the license file. Remove the backup license file on all of the cluster hosts. License register successfully.

  • 新License反注册

    gs_om -t license -m unregister -f MTgsMTkK Preparing for the program initialization. Lock the OPS operation of OM components. Check and make sure the consistency of the license file. Backup the license file on all of the cluster hosts. Encrypt the product feature information and generate the license file. Send message to the 数据库节点 instances to reload the license file. Remove the backup license file on all of the cluster hosts. License unregister successfully.

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论

文集目录
暂无数据