案例说明:

在KingbaseES V8R3集群,network_rewind.sh用于当节点数据库服务down时,实现数据库服务的自动恢复功能。在network_rewind.sh执行时,会对数据库的存储(data)所在的磁盘进行R/W的检查,默认如果读写检查失败,将会关闭数据库;在生产环境,磁盘I/O压力较大的情况下,可能会触发误判,导致数据库关闭,影响正常的应用。可以通过参数调整,在检测失败的情况下,不关闭数据库服务。

适用版本:

KingbaseES V8R3

一、集群架构

TEST=# show pool_nodes;
node_id | hostname | port | status | lb_weight | role | select_cnt | load_balance_node | replication_delay
---------+---------------+-------+--------+-----------+---------+------------+-------------------+-------------------
0 | 192.168.1.101 | 54321 | up | 0.500000 | primary | 0 | false | 0
1 | 192.168.1.102 | 54321 | up | 0.500000 | standby | 0 | true | 0
(2 rows)

二、测试默认磁盘检测功能

1、模拟磁盘检测故障

[root@node102 db]# pwd
/home/kingbase/cluster/HAR3/db
[root@node102 db]# ls -lhd data
drwx------ 20 kingbase kingbase 4.0K Mar 17 10:20 data
[root@node102 db]# chown root.root data
[root@node102 db]# chmod 700 data
[root@node102 db]# ls -lhd data
drwx------ 20 root root 4.0K Mar 17 10:20 data ---如上所示,对于数据存储data目录,数据库用户kingbase无读写权限。

2、查看节点recovery.log

Tips:

默认在KingbaseES V8R3集群,每过一分钟,crond调用network_rewind.sh脚本检测节点数据库状态,可以通过recovery.log获取详细执行信息。

2023-03-17 10:21:01 recover beging...
my pid is 9836,officially began to perform recovery
2023-03-17 10:21:01 check read/write on mount point
2023-03-17 10:21:01 check read/write on mount point (1 / 6).
2023-03-17 10:21:01 stat the directory of the mount point "/home/kingbase/cluster/HAR3/db/data" ...
ls: cannot open directory /home/kingbase/cluster/HAR3/db/data: Permission denied
could not stat the mount point "/home/kingbase/cluster/HAR3/db/data", please check it
could not execute "ls /home/kingbase/cluster/HAR3/db/data".
2023-03-17 10:21:01 failed to check read/write on mount point (1 / 6).
2023-03-17 10:21:11 check read/write on mount point (2 / 6).
2023-03-17 10:21:11 stat the directory of the mount point "/home/kingbase/cluster/HAR3/db/data" ...
ls: cannot open directory /home/kingbase/cluster/HAR3/db/data: Permission denied
could not stat the mount point "/home/kingbase/cluster/HAR3/db/data", please check it
could not execute "ls /home/kingbase/cluster/HAR3/db/data".
2023-03-17 10:21:11 failed to check read/write on mount point (2 / 6).
2023-03-17 10:21:21 check read/write on mount point (3 / 6).
2023-03-17 10:21:21 stat the directory of the mount point "/home/kingbase/cluster/HAR3/db/data" ...
ls: cannot open directory /home/kingbase/cluster/HAR3/db/data: Permission denied
could not stat the mount point "/home/kingbase/cluster/HAR3/db/data", please check it
could not execute "ls /home/kingbase/cluster/HAR3/db/data".
2023-03-17 10:21:21 failed to check read/write on mount point (3 / 6).
2023-03-17 10:21:31 check read/write on mount point (4 / 6).
2023-03-17 10:21:31 stat the directory of the mount point "/home/kingbase/cluster/HAR3/db/data" ...
ls: cannot open directory /home/kingbase/cluster/HAR3/db/data: Permission denied
could not stat the mount point "/home/kingbase/cluster/HAR3/db/data", please check it
could not execute "ls /home/kingbase/cluster/HAR3/db/data".
2023-03-17 10:21:31 failed to check read/write on mount point (4 / 6).
2023-03-17 10:21:41 check read/write on mount point (5 / 6).
2023-03-17 10:21:41 stat the directory of the mount point "/home/kingbase/cluster/HAR3/db/data" ...
ls: cannot open directory /home/kingbase/cluster/HAR3/db/data: Permission denied
could not stat the mount point "/home/kingbase/cluster/HAR3/db/data", please check it
could not execute "ls /home/kingbase/cluster/HAR3/db/data".
2023-03-17 10:21:41 failed to check read/write on mount point (5 / 6).
2023-03-17 10:21:51 check read/write on mount point (6 / 6).
2023-03-17 10:21:51 stat the directory of the mount point "/home/kingbase/cluster/HAR3/db/data" ...
ls: cannot open directory /home/kingbase/cluster/HAR3/db/data: Permission denied
could not stat the mount point "/home/kingbase/cluster/HAR3/db/data", please check it
could not execute "ls /home/kingbase/cluster/HAR3/db/data".
2023-03-17 10:21:51 failed to check read/write on mount point (6 / 6).
2023-03-17 10:22:01 execute check_mount_point() failed, maybe the disk is error
2023-03-17 10:22:01 USE_CHECK_DISK = on, will exit with stop db.
exit with error and stop db.....
sys_ctl: could not open PID file "/home/kingbase/cluster/HAR3/db/data/kingbase.pid": Permission denied
2023-03-17 10:22:01 now will del vip [192.168.1.204/24]
I'm already recovery now pid[9836], return nothing to do,will exit script will success
now, there is no 192.168.1.204/24 on my DEV
......
---如上所示,对“/home/kingbase/cluster/HAR3/db/data”目录读写执行检测。

如下图所示:磁盘检测失败关闭数据库服务

三、调整磁盘检测功能

Tips:

默认" if failed in check_mount_point(), should stop the database? default is on, do stop db",参数
USE_CHECK_DISK=1(默认),将关闭数据库服务;USE_CHECK_DISK=0,不关闭数据库服务。

1、配置磁盘检测参数

[root@node102 db]# cat etc/HAmodule.conf |grep -i disk
USE_CHECK_DISK=0 ---在所有节点HAmodule.conf增加此参数配置(默认配置文件无此参数)。

2、模拟磁盘检测故障

[root@node102 db]# pwd
/home/kingbase/cluster/HAR3/db
[root@node102 db]# ls -lhd data
drwx------ 20 kingbase kingbase 4.0K Mar 17 10:20 data [root@node102 db]# chown root.root data
[root@node102 db]# chmod 700 data
[root@node102 db]# ls -lhd data
drwx------ 20 root root 4.0K Mar 17 10:20 data ---如上所示,对于数据存储data目录,数据库用户kingbase无读写权限。

3、查看节点recovery.log

---------------------------------------------------------------------
2023-03-17 10:33:01 recover beging...
my pid is 16274,officially began to perform recovery
2023-03-17 10:33:01 check read/write on mount point
2023-03-17 10:33:01 check read/write on mount point (1 / 6).
2023-03-17 10:33:01 stat the directory of the mount point "/home/kingbase/cluster/HAR3/db/data" ...
.......
2023-03-17 10:33:51 check read/write on mount point (6 / 6).
2023-03-17 10:33:51 stat the directory of the mount point "/home/kingbase/cluster/HAR3/db/data" ...
ls: cannot open directory /home/kingbase/cluster/HAR3/db/data: Permission denied
could not stat the mount point "/home/kingbase/cluster/HAR3/db/data", please check it
could not execute "ls /home/kingbase/cluster/HAR3/db/data".
2023-03-17 10:33:51 failed to check read/write on mount point (6 / 6).
2023-03-17 10:34:01 execute check_mount_point() failed, maybe the disk is error
2023-03-17 10:34:01 USE_CHECK_DISK = off, do nothing.
2023-03-17 10:34:01 check read/write on mount point ... ok
2023-03-17 10:34:01 check if the network is ok
I'm already recovery now pid[16274], return nothing to do,will exit script will success
ping trust ip 192.168.1.1 success ping times :[3], success times:[2]
determine if i am master or standby
........

如下图所示:磁盘检测失败,但没有触发数据库关闭:

四、总结

磁盘检测功能有助于集群数据库数据的安全,但是在有的生产环境,磁盘I/O压力大情况下,有可能引起误判,可以根据生产应用环境,调整"USE_CHECK_DISK"参数,即保证集群的高可用性,又保证数据的安全。

KingbaseES V8R3 集群运维系列之 -- network_rewind.sh磁盘检测功能详解的更多相关文章

  1. KingbaseES V8R3集群运维案例之---kingbase_monitor.sh启动”two master“案例

    案例说明: KingbaseES V8R3集群,执行kingbase_monitor.sh启动集群,出现"two master"节点的故障,启动集群失败:通过手工sys_ctl启动 ...

  2. KingbaseES V8R3集群运维案例之---主库系统down failover切换过程分析

    ​ 案例说明: KingbaseES V8R3集群failover时两个cluster都会触发,但只有一个cluster会调用脚本去执行真正的切换流程,另一个有对应的打印,但不会调用脚本,只是走相关的 ...

  3. KingbaseES V8R3集群运维案例之---cluster.log ERROR: md5 authentication failed

    案例说明: 在KingbaseES V8R3集群的cluster.log日志中,经常会出现"ERROR: md5 authentication failed:DETAIL: password ...

  4. KingbaseES V8R3集群运维案例之---用户自定义表空间管理

    ​案例说明: KingbaseES 数据库支持用户自定义表空间的创建,并建议表空间的文件存储路径配置到数据库的data目录之外.本案例复现了,当用户自定义表空间存储路径配置到data下时,出现的故障问 ...

  5. KingbaseES V8R3集群维护案例之---pcp_node_refresh应用

    案例说明: 在一次KingbaseES V8R3集群切换分析中,运维人员执行了pcp_node_refresh,导致集群发生了failover的切换.此文档对pcp_node_refresh工具做了应 ...

  6. KingbaseES V8R3集群管理维护案例之---集群迁移单实例架构

    案例说明: 在生产中,需要将KingbaseES V8R3集群转换为单实例架构,可以采用以下方式快速完成集群架构的迁移. 适用版本: KingbaseES V8R3 当前数据库版本: TEST=# s ...

  7. KingbaseES V8R3集群管理和维护案例之---failover切换wal日志变化分析

    ​ 案例说明: 本案例通过对KingbaseES V8R3集群failover切换过程进行观察,分析了主备库切换后wal日志的变化,对应用者了解KingbaseES V8R3(R6) failover ...

  8. KingbaseES V8R3集群维护案例之---在线添加备库管理节点

    案例说明: 在KingbaseES V8R3主备流复制的集群中 ,一般有两个节点是集群的管理节点,分为master和standby:如对于一主二备的架构,其中有两个节点是管理节点,三个数据节点:管理节 ...

  9. Memcached集群/分布式/高可用 及 Magent缓存代理搭建过程 详解

    当网站访问量达到一定时,如何做Memcached集群,又如何高可用,是接下来要讨论的问题. 有这么一段文字来描述“Memcached集群” Memcached如何处理容错的? 不处理!:) 在memc ...

  10. KingbaseES V8R6集群运维案例之---repmgr standby promote应用案例

    案例说明: 在容灾环境中,跨区域部署的异地备节点不会自主提升为主节点,在主节点发生故障或者人为需要切换时需要手动执行切换操作.若主节点已经失效,希望将异地备机提升为主节点. $bin/repmgr s ...

随机推荐

  1. CSS实现图形效果

    CSS实现图形效果 CSS实现正方形.长方形.圆形.半圆.椭圆.三角形.平行四边形.菱形.梯形.六角星.五角星.心形.消息框. 正方形 <section> <div id=" ...

  2. Java实现文件下载断点续传(一)

    参考文章:https://www.ibm.com/developerworks/cn/java/joy-down/ 1.原理介绍 想象一下我们下载一个10G的文件,当下载到9.99G的时候断网了... ...

  3. 通过 saltstack 批量更新 SSL 证书

    哈喽大家好,我是咸鱼. 之前写过两篇关于 SSL 过期巡检脚本的文章: SSL 证书过期巡检脚本 SSL 证书过期巡检脚本(Python 版) 这两篇文章都是讲如何通过脚本去自动检测 SSL 过期时间 ...

  4. 网络安全-Linux常用命令

    安装上传下载的软件包 yum install lrzsz -y 下载:linux-->windows sz -y /etc/hosts 上传:windows-->linux rz -y 系 ...

  5. 【Azure Logic App】在Logic App中使用 Transfer XML组件遇见错误 undefined

    问题描述 在Azure Logic App中,使用Transform XML组件进行XML内容的转换,但是最近这个组件运行始终失败. 问题解答 点击Transform XML组件上的错误案例,并不能查 ...

  6. 【Azure 应用服务】在创建Web App Service的时候,选Linux系统后无法使用Mysql in App

    问题描述 如图上,是App Services在Windows环境中,系统自带了MySQL In App功能.而在,Linux环境中,没有发现Mysql in App功能,是不是无法在Linux中使用呢 ...

  7. 【Azure 环境】使用Azure中的App Service部署Web应用,以Windows为主机系统是否可以启动防病毒,防恶意软件服务呢(Microsoft Antimalware)?

    问题描述 使用Azure中的App Service部署Web应用,以Windows为主机系统是否可以启动防病毒,防恶意软件服务呢? Microsoft Antimalware for Azure is ...

  8. CSRF(Steam的链接不用随便点)

    漏洞详解 CSRF 漏洞原理: 攻击者会冒充或利用用户本人对web服务器发送请求,然而web服务器无法识别该请求是否为用户本人所发送,因此造成各种危害. 漏洞利用过程: 1)首先需要用户登录了上网站, ...

  9. adb monkey 有哪些参数?

    adb monkey 是 Android Debug Bridge (ADB) 工具中的一个命令,用于执行随机事件来对 Android 应用进行压力测试.以下是 adb monkey 命令的一些常用参 ...

  10. Android Handler实现子线程与子线程、主线程之间通信

    一.子线程向主线程传值: 首选在主线程里创建一个Handler 1 Handler mHandler = new Handler(){ 2 @Override 3 public void handle ...