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数据库运行健康状态检查实验结束。


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值