案例说明:

参数archive_cleanup_command可以配置在kingbase.conf文件中,用于备库清理不在需要的归档日志,参数详细说明见下图:

https://postgresqlco.nf/doc/zh/param/archive_cleanup_command/

适用环境:

KingbaseES V8R/R6

集群节点状态:

[kingbase@node2 bin]$ ./repmgr  cluster show
ID | Name | Role | Status | Upstream | Location | Priority | Timeline | Connection string
----+---------+---------+-----------+----------+----------+----------+----------+---------------------------------------------------------------------------------------------------------------------------------------------------
1 | node200 | primary | * running | | default | 100 | 17 | host=192.168.8.200 user=esrep dbname=esrep port=54321 connect_timeout=10 keepalives=1 keepalives_idle=10 keepalives_interval=1 keepalives_count=3
2 | node201 | standby | running | node200 | default | 100 | 17 | host=192.168.8.201 user=esrep dbname=esrep port=54321 connect_timeout=10 keepalives=1 keepalives_idle=10 keepalives_interval=1 keepalives_count=3

1、备库节点配置归档

2、查看当前备库归档信息

[kingbase@node2 bin]$ ls -lh /db/kingbase/arch_ha/
total 401M
-rw------- 1 kingbase kingbase 474 Dec 2 11:21 0000000C.history
-rw------- 1 kingbase kingbase 562 Dec 2 11:21 0000000E.history
-rw------- 1 kingbase kingbase 650 Dec 2 11:21 00000010.history
-rw------- 1 kingbase kingbase 16M Dec 2 11:36 000000110000000200000015
-rw------- 1 kingbase kingbase 16M Dec 2 11:36 000000110000000200000016
-rw------- 1 kingbase kingbase 16M Dec 2 11:36 000000110000000200000017
-rw------- 1 kingbase kingbase 16M Dec 2 11:37 000000110000000200000018
-rw------- 1 kingbase kingbase 16M Dec 2 11:37 000000110000000200000019
-rw------- 1 kingbase kingbase 16M Dec 2 11:37 00000011000000020000001A
-rw------- 1 kingbase kingbase 16M Dec 2 11:38 00000011000000020000001B
-rw------- 1 kingbase kingbase 16M Dec 2 11:38 00000011000000020000001C
-rw------- 1 kingbase kingbase 16M Dec 2 11:38 00000011000000020000001D
-rw------- 1 kingbase kingbase 16M Dec 2 11:39 00000011000000020000001E
-rw------- 1 kingbase kingbase 16M Dec 2 11:39 00000011000000020000001F
-rw------- 1 kingbase kingbase 16M Dec 2 11:39 000000110000000200000020
-rw------- 1 kingbase kingbase 16M Dec 2 11:39 000000110000000200000021
-rw------- 1 kingbase kingbase 16M Dec 2 11:40 000000110000000200000022
-rw------- 1 kingbase kingbase 16M Dec 2 11:40 000000110000000200000023
-rw------- 1 kingbase kingbase 16M Dec 2 11:40 000000110000000200000024
-rw------- 1 kingbase kingbase 16M Dec 2 11:40 000000110000000200000025
-rw------- 1 kingbase kingbase 16M Dec 2 11:41 000000110000000200000026
-rw------- 1 kingbase kingbase 16M Dec 2 11:44 000000110000000200000027
-rw------- 1 kingbase kingbase 16M Dec 2 11:44 000000110000000200000028
-rw------- 1 kingbase kingbase 16M Dec 2 11:44 000000110000000200000029
-rw------- 1 kingbase kingbase 16M Dec 2 11:44 00000011000000020000002A
-rw------- 1 kingbase kingbase 16M Dec 2 11:44 00000011000000020000002B
-rw------- 1 kingbase kingbase 16M Dec 2 11:44 00000011000000020000002C
-rw------- 1 kingbase kingbase 16M Dec 2 11:44 00000011000000020000002D

3、备库执行 checkpoint

test=# checkpoint;
CHECKPOINT

如下sys_log所示:备库在执行checkpoint时,生成了“restart point”,备库在运行期间,也将自动产生“restart point”。

[kingbase@node2 sys_log]$ cat kingbase-2022-12-02_115106.csv|grep point
2022-12-02 11:51:06.873 CST,,,6616,,6389762a.19d8,3,,2022-12-02 11:51:06 CST,,0,DEBUG,00000,"checkpoint record is at 2/2E660E60",,,,,,,,,""
2022-12-02 11:51:06.879 CST,,,6617,,6389762a.19d9,1,,2022-12-02 11:51:06 CST,,0,DEBUG,00000,"checkpointer updated shared memory configuration values",,,,,,,,,""
2022-12-02 11:56:06.979 CST,,,6617,,6389762a.19d9,2,,2022-12-02 11:51:06 CST,,0,LOG,00000,"restartpoint starting: time",,,,,,,,,""
2022-12-02 11:56:07.021 CST,,,6617,,6389762a.19d9,3,,2022-12-02 11:51:06 CST,,0,DEBUG,00000,"updated min recovery point to 2/2E663E28 on timeline 17",,,,,,,,,""
2022-12-02 11:56:07.288 CST,,,6617,,6389762a.19d9,4,,2022-12-02 11:51:06 CST,,0,DEBUG,00000,"performing replication slot checkpoint",,,,,,,,,""
2022-12-02 11:56:07.508 CST,,,6617,,6389762a.19d9,5,,2022-12-02 11:51:06 CST,,0,DEBUG,00000,"checkpoint sync: number=1 file=base/16385/16405 time=13.982 msec",,,,,,,,,""
2022-12-02 11:56:07.509 CST,,,6617,,6389762a.19d9,6,,2022-12-02 11:51:06 CST,,0,DEBUG,00000,"checkpoint sync: number=2 file=base/16385/16388 time=0.681 msec",,,,,,,,,""
2022-12-02 11:56:07.515 CST,,,6617,,6389762a.19d9,12,,2022-12-02 11:51:06 CST,,0,LOG,00000,"restartpoint complete: wrote 2 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.205 s, sync=0.014 s, total=0.535 s; sync files=2, longest=0.013 s, average=0.007 s; distance=11 kB, estimate=11 kB",,,,,,,,,""
2022-12-02 11:56:07.515 CST,,,6617,,6389762a.19d9,13,,2022-12-02 11:51:06 CST,,0,LOG,00000,"recovery restart point at 2/2E663D50","Last completed transaction was at log time 2022-12-02 11:50:54.157512+08.",,,,,,,,""
2022-12-02 11:58:07.840 CST,,,6617,,6389762a.19d9,16,,2022-12-02 11:51:06 CST,,0,DEBUG,00000,"skipping restartpoint, already performed at 2/2E663D50",,,,,,,,,""

4、查看归档日志信息

如下所示:备库将判断哪些归档不在需要,并对这些归档执行清理。

[kingbase@node2 bin]$ ls -lh /db/kingbase/arch_ha/
total 12K
-rw------- 1 kingbase kingbase 474 Dec 2 11:21 0000000C.history
-rw------- 1 kingbase kingbase 562 Dec 2 11:21 0000000E.history
-rw------- 1 kingbase kingbase 650 Dec 2 11:21 00000010.history

Tips:

对于同样的归档配置,在主库,此参数不生效,不会执行归档清理。对于归档日志的清理,可以通过脚本调用sys_archivecleanup工具清理。

单实例环境测试:

1、配置kingbase.conf

2、执行wal日志切换

prod=# insert into t1 values (generate_series(1,10000));
INSERT 0 10000
prod=# select sys_switch_wal();
sys_switch_wal
----------------
0/1A582518
(1 row)

3、查看当前归档日志

如下所示,在执行checkpoint后没有实现归档日志的自动清理。

[kingbase@node102 data]$ ls -l ../arch
total 49152
-rw------- 1 kingbase kingbase 16777216 Dec 12 14:14 000000010000000000000018
-rw------- 1 kingbase kingbase 16777216 Dec 12 14:14 000000010000000000000019
-rw------- 1 kingbase kingbase 16777216 Dec 12 14:16 00000001000000000000001A

KingbaseES V8R6 集群运维系列--archive_cleanup_command参数应用的更多相关文章

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

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

  2. KingbaseES V8R6集群管理运维案例之---repmgr standby switchover故障

    案例说明: 在KingbaseES V8R6集群备库执行"repmgr standby switchover"时,切换失败,并且在执行过程中,伴随着"repmr stan ...

  3. KingbaseES V8R6集群维护案例之---停用集群node_export进程

    案例说明: 在KingbaseES V8R6集群启动时,会启动node_exporter进程,此进程主要用于向kmonitor监控服务输出节点状态信息.在系统安全漏洞扫描中,提示出现以下安全漏洞: 对 ...

  4. kingbaseES V8R6集群备份恢复案例之---备库作为repo主机执行物理备份

    ​ 案例说明: 此案例是在KingbaseES V8R6集群环境下,当主库磁盘空间不足时,执行sys_rman备份,将集群的备库节点作为repo主机,执行备份,并将备份存储在备库的磁盘空间. 集群架构 ...

  5. KingbaseES V8R6集群维护之--修改数据库服务端口案例

    ​ 案例说明: 对于KingbaseES数据库单实例环境,只需要修改kingbase.conf文件的'port'参数即可,但是对于KingbaseES V8R6集群中涉及到多个配置文件的修改,并且在应 ...

  6. KingbaseES V8R6集群外部备份案例

    案例说明: 本案例采用sys_backup.sh执行物理备份,备份使用如下逻辑架构:集群采用CentOS 7系统,repo采用kylin V10 Server. 一主一备+外部备份 此场景为主备双机常 ...

  7. KingbaseES V8R6集群维护案例之--修改securecmdd工具服务端口

    案例说明: 在一些生产环境,为了系统安全,不支持ssh互信,或限制root用户使用ssh登录,KingbaseES V8R6可以使用securecmdd工具支持主机之间的通讯.securecmdd工具 ...

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

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

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

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

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

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

随机推荐

  1. 大白菜方式制作win10 PE启动U盘

    说明 最近帮朋友安装下win10,用了2种制作U盘启动盘的方式.记录一下也方便大家少走弯路. 准备的工具: 1.大白菜软件 2.win10镜像 3.1个U盘,U盘容量 > 8G即可. 制作PE启 ...

  2. spring boot 2.0集成并使用redis

    项目地址:https://gitee.com/indexman/spring_boot_in_action 前面一章介绍了spring boot自带的缓存,下面讲一下如何在2.0版本中集成并使用red ...

  3. linux系统优化命令--day03

    用户管理与文件权限 给普通用户授权 root 用户 修改/etc/sudoers文件,文件非常重要, 不可以随意更改 vim /etc/sudoers 如果想要给用户赋予权限,我们要使用这个命令 vi ...

  4. Mac环境下, VMware Fusion Pro下的虚拟机( CentOS 7)的 NAT网络配置

    前提实现说明 1.vm版本VMware Fusion Pro 12.1.0 2.centos版本centos7.6 1.虚拟机能访问外网,虚拟机能访问mac本机: 2.mac本机可以连接虚拟机 操作步 ...

  5. React 组件懒加载

    只有不断学习和成长,才能适应这个快速变化的世界. 1. 懒加载 1.1 React 懒加载 React 中懒加载 Lazy 与 Suspense 需要搭配使用. React.lazy 定义: Reac ...

  6. ASP.NET Core 微信支付(四)【支付结果通知回调(未按照官方步骤) APIV3】

    官方文档 支付通知API 证书和回调报文解密 参考资料 netcore 中没有Request.InputStream 理论实战 对于我来说,这个微信支付结果通知回调有两个难点. 难点一 一开始在想是怎 ...

  7. 数仓的等待视图中,为什么会有Hashjoin-nestloop

    本文分享自华为云社区<GaussDB(DWS)等待视图之Hashjoin-nestloop>,作者:Arrow0lf. 1. 业务场景 众所周知,GaussDB(DWS)中有3种常见的jo ...

  8. 第一百一十一篇:基本引用类型Date

    好家伙,本篇为<JS高级程序设计>第五章的学习笔记   1.基本引用类型 引用值(或者对象)是某个特定引用类型的实例,在ECMAScript中,引用类型是把数据和功能组织到一起的结构,(像 ...

  9. 【Azure 应用服务】收集App Service 关于Availability Zone, Health check 以及 Traffic Manager的文档,并了解高可用(HA)和灾备(DR)

    问题描述 收集App Service 关于Availability Zone, Health check 以及 Traffic Manager的文档,并了解高可用(HA)和灾备(DR)的具体办法 问题 ...

  10. 批量删除mysql库中数据

    -- 查询构建批量删除表语句(根据数据库名称) select concat('delete from ', TABLE_NAME, ' where org_id = "<条件id> ...