openGauss维护管理之服务端启停工具gs_om

时间:2021-10-13 01:01:14

一、概述

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

1、前提条件

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

2、语法

1、启动openGauss
gs_om -t start [-h HOSTNAME] [-D dataDir] [--time-out=SECS] [--security-mode=MODE] [--cluster-number=None] [-l LOGFILE]

2、停止openGauss
gs_om -t stop [-h HOSTNAME] [-D dataDir] [--time-out=SECS] [-m MODE] [-l LOGFILE]

3、重启openGauss
gs_om -t restart [-h HOSTNAME] [-D dataDir] [--time-out=SECS] [--security-mode=MODE] [-l LOGFILE] [-m MODE]

4、查询openGauss状态
gs_om -t status [-h HOSTNAME] [-o OUTPUT] [--detail] [--all] [-l LOGFILE]

5、生成静态配置文件
gs_om -t generateconf -X XMLFILE [--distribute] [-l LOGFILE]
gs_om -t generateconf --old-values=old --new-values=new [--distribute] [-l LOGFILE]

6、生成动态配置文件,备机failover或switchover成主机后,需要执行此操作
gs_om -t refreshconf

7、查看静态配置
gs_om -t view [-o OUTPUT]

8、查询openGauss状态详细信息
gs_om -t query [-o OUTPUT]

9、SSL证书替换
gs_om -t cert --cert-file=CERTFILE [-l LOGFILE]
gs_om -t cert --rollback

10、开启、关闭数据库内kerberos认证
gs_om -t kerberos -m [install|uninstall] -U USER [-l LOGFILE] [--krb-client|--krb-server]

11、显示帮助信息
gs_om -? | --help

12、显示版本号信息
gs_om -V | --version

3、示例

1、启动openGauss。
gs_om -t start
Starting cluster.
======================================================================
.
======================================================================
Successfully started .

2、停止openGauss。
gs_om -t stop
Stopping cluster.
=========================================
Successfully stopped cluster.
=========================================
End stop cluster.

3、查看openGauss详细状态信息,含实例状态信息。
gs_om -t status --detail
[ Cluster State ]
cluster_state : Normal
redistributing : No
current_az : AZ_ALL
[ Datanode State ]
node node_ip port instance state
-----------------------------------------------------------------------------------------------------------------
1 pekpopgsci00235 10.244.62.204 5432 6001 /opt/gaussdb/cluster/data/dn1 P Primary Normal
2 pekpopgsci00238 10.244.61.81 5432 6002 /opt/gaussdb/cluster/data/dn1 S Standby Normal

4、在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/opengauss/Bigdata/gaussdb/wisequery/script/static_config_files.
Distributing static configuration files to all nodes.
Successfully distributed static configuration files.

5、在openGauss上执行如下命令,修改配置文件,动态配置文件需要执行gs_om -t refreshconf 手动刷新,实际端口或者ip生效需要手动修改guc参数。
gs_om -t generateconf --old-values=26000,192.168.1.1 --new-values=36000,192.168.1.2 --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/opengauss/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