首页 > 数据库 >openGauss学习笔记-135 openGauss 数据库运维-例行维护-检查openGauss健康状态

openGauss学习笔记-135 openGauss 数据库运维-例行维护-检查openGauss健康状态

时间:2023-11-30 19:01:05浏览次数:33  
标签:run 运维 success item 135 OK openGauss nodes gs

openGauss学习笔记-135 openGauss 数据库运维-例行维护-检查openGauss健康状态

135.1 检查办法

通过openGauss提供的gs_check工具可以开展openGauss健康状态检查。

注意事项

  • 扩容新节点检查只能在root用户下执行,其他场景都必须在omm用户下执行。
  • 必须指定-i或-e参数,-i会检查指定的单项,-e会检查对应场景配置中的多项。
  • 如果-i参数中不包含root类检查项或-e场景配置列表中没有root类检查项,则不需要交互输入root权限的用户及其密码。
  • 可使用–skip-root-items跳过检查项中包含的root类检查,以免需要输入root权限用户及密码。
  • 检查扩容新节点与现有节点之间的一致性,在现有节点执行gs_check命令指定–hosts参数进行检查,其中hosts文件中需要写入新节点ip。

135.2 操作步骤

方式1:

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

  2. 执行如下命令对openGauss数据库状态进行检查。

    gs_check -i CheckClusterState
    

    其中,-i指定检查项,注意区分大小写。格式:-i CheckClusterState、-i CheckCPU或-i CheckClusterState,CheckCPU。

    取值范围为所有支持的检查项名称,详细列表请参见《工具与命令参考》中“服务端工具 > gs_checkos > openGauss状态检查表”,用户可以根据需求自己编写新检查项。

方式2:

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

  2. 执行如下命令对openGauss数据库进行健康检查。

    gs_check -e inspect
    

    其中,-e指定场景名,注意区分大小写。格式:-e inspect或-e upgrade。

    取值范围为所有支持的巡检场景名称,默认列表包括:inspect(例行巡检)、upgrade(升级前巡检)、install(安装)、binary_upgrade(就地升级前巡检)、health(健康检查巡检)、slow_node(节点)、longtime(耗时长巡检),用户可以根据需求自己编写场景。

openGauss巡检的主要作用是在openGauss运行过程中,检查整个openGauss状态是否正常,或者重大操作前(升级、扩容),确保openGauss满足操作所需的环境条件和状态条件。详细的巡检项目和场景请参见《工具与命令参考》中“服务端工具 > gs_checkos > openGauss状态检查表”。

示例

执行单项检查结果:

perfadm@lfgp000700749:/opt/huawei/perfadm/tool/script> gs_check -i CheckCPU
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:3

Checking...               [=========================] 1/1
Start to analysis the check result
CheckCPU....................................OK
The item run on 3 nodes.  success: 3

Analysis the check result successfully
Success. All check items run completed. Total:1  Success:1  Failed:0
For more information please refer to /opt/huawei/wisequery/script/gspylib/inspection/output/CheckReport_201902193704661604.tar.gz

本地执行结果:

perfadm@lfgp000700749:/opt/huawei/perfadm/tool/script> gs_check -i CheckCPU -L

2017-12-29 17:09:29 [NAM] CheckCPU
2017-12-29 17:09:29 [STD] 检查主机CPU占用率,如果idle 大于30%并且iowait 小于 30%.则检查项通过,否则检查项不通过
2017-12-29 17:09:29 [RST] OK

2017-12-29 17:09:29 [RAW]
Linux 4.4.21-69-default (lfgp000700749)  12/29/17  _x86_64_

17:09:24        CPU     %user     %nice   %system   %iowait    %steal     %idle
17:09:25        all      0.25      0.00      0.25      0.00      0.00     99.50
17:09:26        all      0.25      0.00      0.13      0.00      0.00     99.62
17:09:27        all      0.25      0.00      0.25      0.13      0.00     99.37
17:09:28        all      0.38      0.00      0.25      0.00      0.13     99.25
17:09:29        all      1.00      0.00      0.88      0.00      0.00     98.12
Average:        all      0.43      0.00      0.35      0.03      0.03     99.17

执行场景检查结果:

[perfadm@SIA1000131072 Check]$ gs_check -e inspect
Parsing the check items config file successfully
The below items require root privileges to execute:[CheckBlockdev CheckIOrequestqueue CheckIOConfigure CheckCheckMultiQueue CheckFirewall CheckSshdService CheckSshdConfig CheckCrondService CheckBootItems CheckFilehandle CheckNICModel CheckDropCache]
Please enter root privileges user[root]:root
Please enter password for user[root]:
Please enter password for user[root] on the node[10.244.57.240]:
Check root password connection successfully
Distribute the context file to remote hosts successfully
Start to health check for the cluster. Total Items:57 Nodes:2

Checking...               [                         ] 21/57
Checking...               [=========================] 57/57
Start to analysis the check result
CheckClusterState...........................OK
The item run on 2 nodes.  success: 2

CheckDBParams...............................OK
The item run on 1 nodes.  success: 1

CheckDebugSwitch............................OK
The item run on 2 nodes.  success: 2

CheckDirPermissions.........................OK
The item run on 2 nodes.  success: 2

CheckReadonlyMode...........................OK
The item run on 1 nodes.  success: 1

CheckEnvProfile.............................OK
The item run on 2 nodes.  success: 2  (consistent)
The success on all nodes value:
GAUSSHOME        /usr1/gaussdb/app
LD_LIBRARY_PATH  /usr1/gaussdb/app/lib
PATH             /usr1/gaussdb/app/bin


CheckBlockdev...............................OK
The item run on 2 nodes.  success: 2

CheckCurConnCount...........................OK
The item run on 1 nodes.  success: 1

CheckCursorNum..............................OK
The item run on 1 nodes.  success: 1

CheckPgxcgroup..............................OK
The item run on 1 nodes.  success: 1

CheckDiskFormat.............................OK
The item run on 2 nodes.  success: 2

CheckSpaceUsage.............................OK
The item run on 2 nodes.  success: 2

CheckInodeUsage.............................OK
The item run on 2 nodes.  success: 2

CheckSwapMemory.............................OK
The item run on 2 nodes.  success: 2

CheckLogicalBlock...........................OK
The item run on 2 nodes.  success: 2

CheckIOrequestqueue.....................WARNING
The item run on 2 nodes.  warning: 2
The warning[host240,host157] value:
On device (vdb) 'IO Request' RealValue '256' ExpectedValue '32768'
On device (vda) 'IO Request' RealValue '256' ExpectedValue '32768'

CheckMaxAsyIOrequests.......................OK
The item run on 2 nodes.  success: 2

CheckIOConfigure............................OK
The item run on 2 nodes.  success: 2

CheckMTU....................................OK
The item run on 2 nodes.  success: 2  (consistent)
The success on all nodes value:
1500

CheckPing...................................OK
The item run on 2 nodes.  success: 2

CheckRXTX...................................NG
The item run on 2 nodes.  ng: 2
The ng[host240,host157] value:
NetWork[eth0]
RX: 256
TX: 256


CheckNetWorkDrop............................OK
The item run on 2 nodes.  success: 2

CheckMultiQueue.............................OK
The item run on 2 nodes.  success: 2

CheckEncoding...............................OK
The item run on 2 nodes.  success: 2  (consistent)
The success on all nodes value:
LANG=en_US.UTF-8

CheckFirewall...............................OK
The item run on 2 nodes.  success: 2

CheckKernelVer..............................OK
The item run on 2 nodes.  success: 2  (consistent)
The success on all nodes value:
3.10.0-957.el7.x86_64 

CheckMaxHandle..............................OK
The item run on 2 nodes.  success: 2

CheckNTPD...................................OK
host240: NTPD service is running, 2020-06-02 17:00:28
host157: NTPD service is running, 2020-06-02 17:00:06


CheckOSVer..................................OK
host240: The current OS is centos 7.6 64bit.
host157: The current OS is centos 7.6 64bit.


CheckSysParams..........................WARNING
The item run on 2 nodes.  warning: 2
The warning[host240,host157] value:
Warning reason: variable 'net.ipv4.tcp_retries1' RealValue '3' ExpectedValue '5'.
Warning reason: variable 'net.ipv4.tcp_syn_retries' RealValue '6' ExpectedValue '5'.


CheckTHP....................................OK
The item run on 2 nodes.  success: 2

CheckTimeZone...............................OK
The item run on 2 nodes.  success: 2  (consistent)
The success on all nodes value:
+0800

CheckCPU....................................OK
The item run on 2 nodes.  success: 2

CheckSshdService............................OK
The item run on 2 nodes.  success: 2

Warning reason: UseDNS parameter is not set; expected: no

CheckCrondService...........................OK
The item run on 2 nodes.  success: 2

CheckStack..................................OK
The item run on 2 nodes.  success: 2  (consistent)
The success on all nodes value:
8192

CheckSysPortRange...........................OK
The item run on 2 nodes.  success: 2

CheckMemInfo................................OK
The item run on 2 nodes.  success: 2  (consistent)
The success on all nodes value:
totalMem: 31.260929107666016G

CheckHyperThread............................OK
The item run on 2 nodes.  success: 2

CheckTableSpace.............................OK
The item run on 1 nodes.  success: 1


CheckSysadminUser...........................OK
The item run on 1 nodes.  success: 1


CheckGUCConsistent..........................OK
All DN instance guc value is consistent.

CheckMaxProcMemory..........................OK
The item run on 1 nodes.  success: 1

CheckBootItems..............................OK
The item run on 2 nodes.  success: 2

CheckHashIndex..............................OK
The item run on 1 nodes.  success: 1

CheckPgxcRedistb............................OK
The item run on 1 nodes.  success: 1

CheckNodeGroupName..........................OK
The item run on 1 nodes.  success: 1

CheckTDDate.................................OK
The item run on 1 nodes.  success: 1

CheckDilateSysTab...........................OK
The item run on 1 nodes.  success: 1

CheckKeyProAdj..............................OK
The item run on 2 nodes.  success: 2

CheckProStartTime.......................WARNING
host157:
STARTED COMMAND
Tue Jun  2 16:57:18 2020 /usr1/dmuser/dmserver/metricdb1/server/bin/gaussdb --single_node -D /usr1/dmuser/dmb1/data -p 22204
Mon Jun  1 16:15:15 2020 /usr1/gaussdb/app/bin/gaussdb -D /usr1/gaussdb/data/dn1 -M standby


CheckFilehandle.............................OK
The item run on 2 nodes.  success: 2

CheckRouting................................OK
The item run on 2 nodes.  success: 2

CheckNICModel...............................OK
The item run on 2 nodes.  success: 2  (consistent)
The success on all nodes value:
version: 1.0.1
model: Red Hat, Inc. Virtio network device


CheckDropCache..........................WARNING
The item run on 2 nodes.  warning: 2
The warning[host240,host157] value:
No DropCache process is running

CheckMpprcFile..............................NG
The item run on 2 nodes.  ng: 2
The ng[host240,host157] value:
There is no mpprc file

Analysis the check result successfully
Failed. All check items run completed. Total:57   Success:50   Warning:5   NG:2
For more information please refer to /usr1/gaussdb/tool/script/gspylib/inspection/output/CheckReport_inspect611.tar.gz

135.3 异常处理

如果发现检查结果异常,可以根据以下内容进行修复。

表 1 检查openGauss运行状态

检查项 异常状态 处理方法
CheckClusterState(检查openGauss状态) openGauss未启动或openGauss实例未启动 使用以下命令启动openGauss及实例。gs_om -t start
openGauss状态异常或openGauss实例异常 检查各主机、实例状态,根据状态信息进行排查。gs_check -i CheckClusterState
CheckDBParams(检查数据库参数) 数据库参数错误 通过gs_guc工具修改数据库参数为指定值。
CheckDebugSwitch(检查调试日志) 日志级别不正确 使用gs_guc工具将log_min_messages改为指定内容。
CheckDirPermissions(检查目录权限) 路径权限错误 修改对应目录权限为指定数值(750/700)。chmod 700 DIR
CheckReadonlyMode(检查只读模式) 只读模式被打开 确认数据库节点所在磁盘使用率未超阈值(默认85%)且未在执行其他运维操作。gs_check -i CheckDataDiskUsage ps ux使用gs_guc工具关闭openGauss只读模式。gs_guc reload -N all -I all -c 'default_transaction_read_only = off'
CheckEnvProfile(检查环境变量) 环境变量不一致 重新执行前置更新环境变量信息。
CheckBlockdev(检查磁盘预读块) 磁盘预读块大小不为16384 使用gs_checkos设置预读块大小为16384KB,并写入自启动文件。gs_checkos -i B3
CheckCursorNum(检查游标数) 检查游标数失败 检查数据库能否正常连接,openGauss状态是否正常。
CheckPgxcgroup(检查重分布状态) 有未完成重分布的pgxc_group表 继续完成扩容或缩容的数据重分布操作。gs_expand、gs_shrink
CheckDiskFormat(检查磁盘配置) 各节点磁盘配置不一致 将各节点的磁盘规格改为相同。
CheckSpaceUsage(检查磁盘空间使用率) 磁盘可用空间不足 清理或扩展对应目录所在的磁盘。
CheckInodeUsage(检查磁盘索引使用率) 磁盘可用索引不足 清理或扩展对应目录所在的磁盘。
CheckSwapMemory(检查交换内存) 交换内存大于物理内存 将交换内存调小或关闭。
CheckLogicalBlock(检查磁盘逻辑块) 磁盘逻辑块大小不为512 使用gs_checkos修改磁盘逻辑块大小为512KB,并写入开机自启动文件。gs_checkos -i B4
CheckIOrequestqueue(检查IO请求) IO请求值不为32768 使用gs_checkos设置IO请求值为32768,并写入开机自启动文件。gs_checkos -i B4
CheckCurConnCount(检查当前连接数)111 当前连接数超过最大连接数的90% 断开未使用的数据库主节点连接。
CheckMaxAsyIOrequests(检查最大异步请求) 最大异步请求值小于104857600或当前节点数据库实例数乘以1048576 使用gs_checkos设置最大异步请求值为104857600和当前节点数据库实例数乘以1048576中的最大值。gs_checkos -i B4
CheckMTU(检查MTU值) MTU值不一致 设置各节点的MTU一致为1500或8192。ifconfig eth* MTU 1500
CheckIOConfigure(检查IO配置) IO配置不是deadline 使用gs_checkos设置IO配置为deadline,并写入开机自启动文件。gs_checkos -i B4
CheckRXTX(检查RXTX值) 网卡RX/TX值不是4096 使用checkos设置openGauss使用的物理网卡RX/TX值为4096。gs_checkos -i B5
CheckPing(检查网络通畅) 存在openGauss IP无法ping通 检查异常ip间网络设置和状态、防火墙状态。
CheckNetWorkDrop(检查网络丢包率) 网络通信丢包率高于1% 检查对应IP间网络负载、状态。
CheckMultiQueue(检查网卡多队列) 未开启网卡多队列并未将网卡中断绑定到不同CPU核心 开启网卡多队列并将网卡队列中断绑定到不同的CPU核心。
CheckEncoding(检查编码格式) 各节点编码格式不一致 在/etc/profile中写入一致的编码信息。echo "export LANG=XXX" >> /etc/profile
CheckFirewall(检查防火墙) 防火墙未关闭 关闭防火墙服务。systemctl disable firewalld.service systemctl stop firewalld.service
CheckMaxHandle(检查最大文件句柄数) 最大文件句柄数小于1000000 设置91-nofile.conf/90-nofile.conf最大文件句柄数软硬限制为1000000。gs_checkos -i B2
CheckNTPD(检查时间同步服务) NTPD服务未开启或时间误差超过一分钟 开启NTPD服务并设置时钟一致。
CheckSysParams(检查操作系统参数) 操作系统参数设置不满足要求 使用gs_checkos进行参数设置或手动设置。gs_checkos -i B1 vim /etc/sysctl.conf
CheckTHP(检查THP服务) THP服务未开启 使用gs_checkos设置THP服务。gs_checkos -i B6
CheckTimeZone(检查时区) 时区不一致 设置各节点为同一时区。cp /usr/share/zoneinfo/\$主时区/$次时区\ /etc/localtime
CheckCPU(检查CPU) CPU占用过高或IO等待过高 进行CPU配置升级或磁盘性能升级。
CheckSshdService(检查SSHD服务) 未开启SSHD服务 启动SSHD服务并写入开机自启动文件。service sshd start echo "server sshd start" >> initFile
CheckSshdConfig(检查SSHD配置) SSHD服务配置错误 设置SSHD服务,PasswordAuthentication=no; MaxStartups=1000;UseDNS=yes; ClientAliveInterval=10800/ClientAliveInterval=0并重启服务:server sshd start
CheckCrondService(检查Crond服务) Crond服务未启动 安装Crond服务并启用。
CheckStack(检查堆栈大小) 堆栈大小小于3072 使用gs_checkos设置为3072并重启堆栈值过小进程。gs_checkos -i B2
CheckSysPortRange(检查系统端口设置) 系统ip端口不在预期范围内或openGauss端口在系统ip端口内 设置系统ip端口范围参数到26000-65535之中;设置openGauss端口在系统ip端口范围外。vim /etc/sysctl.conf
CheckMemInfo(检查内存信息) 各节点内存大小不一致 使用相同规格的物理内存。
CheckHyperThread(检查超线程) 未开启CPU超线程 开启CPU超线程。
CheckTableSpace(检查表空间) 表空间路径和openGauss路径存在嵌套或表空间路径相互存在嵌套 将表空间数据迁移到路径合法的表空间中。

标签:run,运维,success,item,135,OK,openGauss,nodes,gs
From: https://blog.51cto.com/shuchaoyang/8633612

相关文章

  • 恒驰服务 | 华为云云上运维服务offering
    恒驰运维服务主要针对运维要求高或自身运维能力有限的客户,通过服务增购的形式,提供运维服务以协助客户做好云上资源运维管理,规避业务风险,降低运维开销,提升客户业务稳定性。适用场景:如何保障业务稳定——系统频繁宕机/网站崩溃如何优化如何提升运维能力——缺少云运维人力和经验如何......
  • linux系统运维-基础
    Linux发展史与安装一、Linux发展史1、Linux前身-Unix1968年 Multics项目MIT、Bell实验室、美国通用电气有限公司走到了一起,致力于开发Multics项目。到后期由于开发进度不是很好,MIT和Bell实验室相继离开这个项目的开发,最终导致项目搁浅。 1970年(Unix元年,时间戳)  Unix诞......
  • openGauss学习笔记-134 openGauss 数据库运维-例行维护-检查操作系统参数
    openGauss学习笔记-134openGauss数据库运维-例行维护-检查操作系统参数134.1检查办法通过openGauss提供的gs_checkos工具可以完成操作系统状态检查。前提条件当前的硬件和网络环境正常。各主机间root互信状态正常。只能使用root用户执行gs_checkos命令。操作步骤以r......
  • 软件运维实施checklist
    软件运维实施checklist可以帮助您确保在部署和维护软件时没有遗漏或错误。以下是一些通用的步骤,可用于创建一个软件运维实施checklist:定义需求:定义您要检查的内容,例如安全、性能、可靠性、兼容性等。确定关键指标:确定关键指标,以便您可以跟踪和分析每个指标的性能。制定操作策略......
  • 运维应急流程
    运维应急流程原创 gaolc888 运维笑谈 2023-11-1608:00 发表于广东收录于合集#运维流程3个1.目的规范IT紧急故障的处理过程,以最快时间诊断和定位故障原因,采取或制定最佳应急方案,在最短时间内恢复系统故障。2.正文2.1术语定义紧急故障处理是运营体系服务保障......
  • 智慧城市大脑,运维无忧!
      运维管理软件在智慧城市中发挥着重要的作用,可以提升IT资源管理效率、保障城市运营安全稳定、实现数据可视化与智能分析、优化资源配置与决策支持、促进智慧城市可持续发展。在智慧城市中,运维管理软件的应用场景非常广泛。以下是其中几个具体应用场景:1. 政务云数据中心:运维管......
  • 运维初级实践——Linux系统命令教程
    区块链运维工程师在Linux环境中常用的命令、快捷键,以及安装软件和文件管理的最佳实践。1.常用Linux命令1.1文件和目录操作ls:列出目录内容cd:更改目录mkdir:创建新目录rm:删除文件或目录cp:复制文件或目录mv:移动或重命名文件或目录#列出当前目录的内容ls......
  • 【HMS Core】帐号服务报错907135000
    ​【问题描述】集成华为帐号服务,AccountAuthService登陆时,返回错误码:907135000 【解决方案】参考文档中错误码说明如下:​https://developer.huawei.com/consumer/cn/doc/development/hmscore-common-References/error-code-0000001050045846请从以下几个方面排查:1、请检查......
  • 【OpenGauss】CentOS安装
    【OpenGauss】CentOS安装1、关闭防火墙修改vim/etc/selinux/configSELINUX=disabled#禁止自动启动systemctldisablefirewalld.service#停止防火请systemctlstopfirewalld.service#重启系统reboot#查看状态systemctlstatusfirewalld ......
  • Oracle 数据库表空间运维
    --https://blog.csdn.net/hanjianahanjian/article/details/83871567--1、block:是Oracle中存储数据块的最小单位,所以数据最终都是存储在block中。它也被称为逻辑blocks或是页(pages)。每个操作系统都有自己的blocksize。而这里的block是Oracle自己的,不同2于2、extent:OS的blocks......