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

文章目录

    • openGauss学习笔记-135 openGauss 数据库运维-例行维护-检查openGauss健康状态
      • 135.1 检查办法
      • 135.2 操作步骤
      • 135.3 异常处理

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:3Checking...               [=========================] 1/1
Start to analysis the check result
CheckCPU....................................OK
The item run on 3 nodes.  success: 3Analysis 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 -L2017-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] OK2017-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:2Checking...               [                         ] 21/57
Checking...               [=========================] 57/57
Start to analysis the check result
CheckClusterState...........................OK
The item run on 2 nodes.  success: 2CheckDBParams...............................OK
The item run on 1 nodes.  success: 1CheckDebugSwitch............................OK
The item run on 2 nodes.  success: 2CheckDirPermissions.........................OK
The item run on 2 nodes.  success: 2CheckReadonlyMode...........................OK
The item run on 1 nodes.  success: 1CheckEnvProfile.............................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/binCheckBlockdev...............................OK
The item run on 2 nodes.  success: 2CheckCurConnCount...........................OK
The item run on 1 nodes.  success: 1CheckCursorNum..............................OK
The item run on 1 nodes.  success: 1CheckPgxcgroup..............................OK
The item run on 1 nodes.  success: 1CheckDiskFormat.............................OK
The item run on 2 nodes.  success: 2CheckSpaceUsage.............................OK
The item run on 2 nodes.  success: 2CheckInodeUsage.............................OK
The item run on 2 nodes.  success: 2CheckSwapMemory.............................OK
The item run on 2 nodes.  success: 2CheckLogicalBlock...........................OK
The item run on 2 nodes.  success: 2CheckIOrequestqueue.....................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: 2CheckIOConfigure............................OK
The item run on 2 nodes.  success: 2CheckMTU....................................OK
The item run on 2 nodes.  success: 2  (consistent)
The success on all nodes value:
1500CheckPing...................................OK
The item run on 2 nodes.  success: 2CheckRXTX...................................NG
The item run on 2 nodes.  ng: 2
The ng[host240,host157] value:
NetWork[eth0]
RX: 256
TX: 256CheckNetWorkDrop............................OK
The item run on 2 nodes.  success: 2CheckMultiQueue.............................OK
The item run on 2 nodes.  success: 2CheckEncoding...............................OK
The item run on 2 nodes.  success: 2  (consistent)
The success on all nodes value:
LANG=en_US.UTF-8CheckFirewall...............................OK
The item run on 2 nodes.  success: 2CheckKernelVer..............................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: 2CheckNTPD...................................OK
host240: NTPD service is running, 2020-06-02 17:00:28
host157: NTPD service is running, 2020-06-02 17:00:06CheckOSVer..................................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: 2CheckTimeZone...............................OK
The item run on 2 nodes.  success: 2  (consistent)
The success on all nodes value:
+0800CheckCPU....................................OK
The item run on 2 nodes.  success: 2CheckSshdService............................OK
The item run on 2 nodes.  success: 2Warning reason: UseDNS parameter is not set; expected: noCheckCrondService...........................OK
The item run on 2 nodes.  success: 2CheckStack..................................OK
The item run on 2 nodes.  success: 2  (consistent)
The success on all nodes value:
8192CheckSysPortRange...........................OK
The item run on 2 nodes.  success: 2CheckMemInfo................................OK
The item run on 2 nodes.  success: 2  (consistent)
The success on all nodes value:
totalMem: 31.260929107666016GCheckHyperThread............................OK
The item run on 2 nodes.  success: 2CheckTableSpace.............................OK
The item run on 1 nodes.  success: 1CheckSysadminUser...........................OK
The item run on 1 nodes.  success: 1CheckGUCConsistent..........................OK
All DN instance guc value is consistent.CheckMaxProcMemory..........................OK
The item run on 1 nodes.  success: 1CheckBootItems..............................OK
The item run on 2 nodes.  success: 2CheckHashIndex..............................OK
The item run on 1 nodes.  success: 1CheckPgxcRedistb............................OK
The item run on 1 nodes.  success: 1CheckNodeGroupName..........................OK
The item run on 1 nodes.  success: 1CheckTDDate.................................OK
The item run on 1 nodes.  success: 1CheckDilateSysTab...........................OK
The item run on 1 nodes.  success: 1CheckKeyProAdj..............................OK
The item run on 2 nodes.  success: 2CheckProStartTime.......................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 standbyCheckFilehandle.............................OK
The item run on 2 nodes.  success: 2CheckRouting................................OK
The item run on 2 nodes.  success: 2CheckNICModel...............................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 deviceCheckDropCache..........................WARNING
The item run on 2 nodes.  warning: 2
The warning[host240,host157] value:
No DropCache process is runningCheckMpprcFile..............................NG
The item run on 2 nodes.  ng: 2
The ng[host240,host157] value:
There is no mpprc fileAnalysis 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路径存在嵌套或表空间路径相互存在嵌套将表空间数据迁移到路径合法的表空间中。

👍 点赞,你的认可是我创作的动力!

⭐️ 收藏,你的青睐是我努力的方向!

✏️ 评论,你的意见是我进步的财富!

图片

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/234402.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

天眼销:超有用的企业获客工具

天眼销是资深数据团队开发的一个客户资源查询平台,可以通过多重筛选:企业名称/信用代码,所在地区,行业,注册资本,年限,是否在营/有电话/邮箱等。 天眼销和某查查有什么区别? 天*查/…

【蓝桥杯选拔赛真题70】Scratch输入输出数字 少儿编程scratch图形化编程 蓝桥杯创意编程选拔赛真题解析

目录 scratch输入输出数字 一、题目要求 编程实现 二、案例分析 1、角色分析

如何做好前端单元测试?字节5年测试老司机是这样说的!

近几年,前端发展越来越迅猛,各类框架层出不穷,前端实现的业务逻辑也越来越复杂,前端单元测试也越来越受重视,包括百度在内的一些大厂在面试中也会问到单元测试相关的题目。那么前端应该如何做好单元测试? 什…

Oracle SQL优化

1、书写顺序和执行顺序 在Oracle SQL中,查询的书写顺序和执行顺序是不同的。 1.1SQL书写顺序如下: SELECTFROMWHEREGROUP BYHAVINGORDER BY 1.2 SQL执行顺序 FROM:数据源被确定,表连接操作也在此步骤完成。 WHERE:对…

kafka中的常见问题处理

文章目录 1. 如何防⽌消息丢失2. 如何防⽌重复消费3. 如何做到消息的顺序消费4. 如何解决消息积压问题4.1 消息积压问题的出现4.2 消息积压的解决⽅案 5. 实现延时队列的效果5.1 应用场景5.2 具体方案 1. 如何防⽌消息丢失 ⽣产者:1)使⽤同步发送 2&…

关于 SLO,我们需要了解什么?

什么是 SLO? SLO(Service Level Objective)是服务质量目标的短语缩写。它通常指的是维护系统的最高级别的目标,或服务等级协议(SLA)中的服务质量目标。它能够定义客户和用户在使用软件系统时所期望的服务质…

无公网IP环境如何远程访问本地内网搭建的Emby影音库服务器

文章目录 1.前言2. Emby网站搭建2.1. Emby下载和安装2.2 Emby网页测试 3. 本地网页发布3.1 注册并安装cpolar内网穿透3.2 Cpolar云端设置3.3 Cpolar内网穿透本地设置 4.公网访问测试5.结语 1.前言 在现代五花八门的网络应用场景中,观看视频绝对是主力应用场景之一&…

2024年软考高级信息系统项目管理师备考攻略

软考高级信息系统项目管理师是一项合格性考试,考试内容相对有限,因此真题的重复率较高。下一次考试与上一次相比,重复率不高,但与之前所有年份的真题相比,重复率较高。在这几次考试中,我认为最重要的是务必…

5. 文件属性和目录

5. 文件属性和目录 1. Linux 系统的文件类型1.1 普通文件1.2 目录文件1.3 字符设备文件和块设备文件1.4 符号链接文件1.5 管道文件1.6 套接字文件 2. stat 系统调用2.1 struct stat 结构体2.2 st_mode 变量2.3 struct timespec 结构体 3. fstat 和 lstat 函数3.1 fstat 函数3.2…

黑马微信小程序学习笔记

小程序和普通网页的区别 1、运行环境不同 网页运行在浏览器环境中 小程序运行在微信环境中 2、API不同 由于运行环境的不同,在小程序中无法调用DOM和BOM 的API(因为这两个API是浏览器暴露出来的,微信环境没有) 但是可以调用微信提…

ELK+filebeat+kafka

无需创建logstash的端口,直接创建topic 远程收集mysql和httpd的日志 (一)安装nginx和mysql服务 1、打开mysql的日志功能 2、创建日志(创库、创表、添加数据) (1)mysql服务器上安装http system…

Linux 命令pwd

命令作用 pwd是Linux中一个非常有用而又十分简单的命令,pwd是词组print working directory的首字母缩写,即打印工作目录;工作目录就是你当前所处于的那个目录。 pwd始终以绝对路径的方式打印工作目录,即从根目录(/&am…