openGauss数据库维护管理指导(二)

2.openGauss运行健康状态检查

2.1 实验介绍

2.1.1 关于本实验

gs_check能够帮助用户在openGauss运行过程中,全量的检查openGauss运行环境,操作系统环境,网络环境及数据库执行环境,也有助于在openGauss重大操作之前对各类环境进行全面检查,有效保证操作执行成功。

本实验主要是通过gs_check工具来检查openGauss数据库运行状态。先进行场景设置,然后根据检查结果进行数据库调整。

语法如下:

单项检查:

gs_check -i ITEM [...] [-U USER] [-L] [-l LOGFILE] [-o OUTPUTDIR] [--skip-root-items][--set][--routing]

场景检查:

gs_check -e SCENE_NAME [-U USER] [-L] [-l LOGFILE] [-o OUTPUTDIR] [--hosts] [--skip-root-items] [--time-out=SECS][--set][--routing][--skip-items]

场景检查项。默认的场景有inspect(例行巡检)、upgrade(升级前巡检)、binary_upgrade(就地升级前巡检)、health(健康检查巡检)、install(安装),等,用户可以根据需求自己编写场景。

显示帮助信息。

gs_check -? | --help

2.1.2 实验目的

掌握gs_check工具的基本使用

2.2 场景设置及操作步骤

步骤 1 用root用户登录装有openGauss数据库服务的操作系统然后用 su - omm命令切换至omm用户环境,登录后信息如下。

Welcome to 4.19.90-2003.4.0.0036.oe1.aarch64

System information as of time: Tue Jul 21 09:21:11 CST 2020

System load: 0.01

Processes: 109

Memory used: 6.7%

Swap used: 0.0%

Usage On: 15%

IP address: 192.168.0.96

Users online: 1

[root@ecs-e1b3 ~]# su - omm

Last login: Fri Jul 10 19:05:39 CST 2020 on pts/0

Welcome to 4.19.90-2003.4.0.0036.oe1.aarch64

System information as of time: Tue Jul 21 09:21:25 CST 2020

System load: 0.01

Processes: 111

Memory used: 7.0%

Swap used: 0.0%

Usage On: 15%

IP address: 192.168.0.96

Users online: 1

[omm@ecs-e1b3 ~]$

步骤 2 确认openGauss数据库服务是否启动。

[omm@ecs-e1b3 ~]$ gs_om -t status;

----------------------------------------------------------------------

cluster_state : Normal

redistributing : No

----------------------------------------------------------------------

cluster_state : Normal 表示已启动,可以正常使用。如果状态为非Normal表示不可用

为了实验场景设置,如果数据库服务已经启动,请执行步骤3先关闭服务。

步骤 3 关闭openGauss数据库服务。

[omm@ecs-e1b3 ~]$ gs_om -t stop;

Stopping cluster.

=========================================

Successfully stopped cluster.

=========================================

End stop cluster.

步骤 4 检查openGauss实例连接。

[omm@ecs-e1b3 ~]$ gs_check -i CheckDBConnection

Parsing the check items config file successfully

Distribute the context file to remote hosts successfully

Start to health check for the cluster. Total Items:1 Nodes:1

Checking... [=========================] 1/1

Start to **ysis the check result

CheckDBConnection...........................NG

The item run on 1 nodes. ng: 1 

The ng[ecs-e1b3] value:

The database can not be connected.

**ysis the check result successfully

Failed.All check items run completed. Total:1 NG:1 

For more information please refer to /opt/huawei/wisequery/script/gspylib/inspection/output/CheckReport_2020072139449163171.tar.gz

说明:

CheckDBConnection…NG 表示连接检查项无用;

The database can not be connected. 表示实例不能连接;

Failed. All check items run completed. Total:1 NG:1 表示共检查1项并且检查结果未通过。

步骤 5 启动openGauss数据库服务。

[omm@ecs-e1b3 ~]$ gs_om -t start;

Starting cluster.

=========================================

=========================================

Successfully started.

[omm@ecs-e1b3 ~]$

步骤 6 确认openGauss数据库服务已启动。

[omm@ecs-e1b3 ~]$ gs_om -t status;

----------------------------------------------------------------------

cluster_state : Normal

redistributing : No

----------------------------------------------------------------------

[omm@ecs-e1b3 ~]$

步骤 7 再次检查openGauss实例连接。

[omm@ecs-e1b3 ~]$ gs_check -i CheckDBConnection

Parsing the check items config file successfully

Distribute the context file to remote hosts successfully

Start to health check for the cluster. Total Items:1 Nodes:1

Checking... [=========================] 1/1

Start to **ysis the check result

CheckDBConnection...........................OK

The item run on 1 nodes. success: 1 

**ysis the check result successfully

Success.All check items run completed. Total:1 Success:1 

For more information please refer to /opt/huawei/wisequery/script/gspylib/inspection/output/CheckReport_2020072140672174672.tar.gz

说明:

CheckDBConnection…OK 表示连接检查项正常;

Success. All check items run completed. Total:1 Success:1 表示共检查1项并且检查结果成功。

openGauss数据库运行健康状态检查实验结束。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容