GBase 8a同步日志归档老化功能使用说明

GBase 8a数据库集群,支持表级的故障定位和恢复,内部通过同步程序进行数据一致性校验和恢复,其同步日志记录在计算节点的log目录下,且以表和发起日期为单位。如果某些节点故障时间较长,需要同步的表很多,就会导致产生大量的同步日志文件。GBase 8a提供了同步日志归档功能,来自动对这类日志文件做归档和老化。

配置文件

[gbase@rh6-1 gbase]$ cd /opt/gnode/config/
[gbase@rh6-1 config]$ cat synctool.conf
SERVER_PORT=5288
LOG_LEVEL=3
BLOCK_SIZE=512
LOG_PACK_TYPE=1
LOG_PACK_SIZE=1
LOG_ROTATE=31

说明

SERVER_PORT

SYNC_SERVER的端口号

LOG_LEVEL

日志级别

LOG_PACK_TYPE

归档方式
1 按天归档 默认
2 按文件个数归档
3 按容量归档

LOG_PACK_SIZE

归档参数根据归档方式,不同的含义
1、天数 1-500, 默认1 , 日志达到间隔天数打包
2、个数 1-500,默认 20. 日志达到指定文件数量打包
3、尺寸 1-500K/M/G, 默认10M ,日志达到执行容量打包。 默认单位M

如参数超过范围,则全部恢复到默认。

执行程序

采用的是操作系统dbauser(一般是gbase用户)的crontab定时执行。

[gbase@rh6-2 ~]$ crontab -l
0 */2 * * * /opt/gnode/server/bin/gc_syncpacklog.sh /opt

测试样例

人工制造一些文档,测试打包功能。 为了方便,采用了手工调用定时任务脚本的方法。

[root@rh6-1 gcinstall]# date -s 20201026
Mon Oct 26 00:00:00 CST 2020
[root@rh6-1 gcinstall]# su gbase
[gbase@rh6-1 gcinstall]$ cd /opt/gnode/log/gbase/sync_log/
[gbase@rh6-1 sync_log]$ ll
total 0
[gbase@rh6-1 sync_log]$ touch 1.log
[gbase@rh6-1 sync_log]$ touch 2.log
[gbase@rh6-1 sync_log]$ touch 3.log
[gbase@rh6-1 sync_log]$ touch 4.log
[gbase@rh6-1 sync_log]$ exit
exit
[root@rh6-1 gcinstall]# date -s '20201027 09:25:00'
Tue Oct 27 09:25:00 CST 2020
[root@rh6-1 gcinstall]# date
Tue Oct 27 09:25:05 CST 2020
[root@rh6-1 gcinstall]#
[root@rh6-1 gcinstall]# su - gbase
[gbase@rh6-1 ~]$ cd /opt/gnode/log/gbase/
[gbase@rh6-1 gbase]$ ll
total 28
-rw------- 1 gbase gbase   49 Oct 27 08:51 express.log
-rw------- 1 gbase gbase    5 Oct 27 08:51 gbased.pid
drwx------ 2 gbase gbase 4096 Oct 27 08:51 loader_logs
-rw------- 1 gbase gbase    0 Oct 27 08:51 loader_result.log
drwxr-xr-x 2 gbase gbase 4096 Oct 26 00:00 sync_log
-rw------- 1 gbase gbase 1987 Oct 27 09:21 syncserver.log
-rw------- 1 gbase gbase    4 Oct 27 08:51 syncserver.pid
-rw------- 1 gbase gbase  576 Oct 27 08:51 system.log
[gbase@rh6-1 gbase]$ cd sync_log/
[gbase@rh6-1 sync_log]$ ll
total 0
-rw-rw-r-- 1 gbase gbase 0 Oct 26 00:00 1.log
-rw-rw-r-- 1 gbase gbase 0 Oct 26 00:00 2.log
-rw-rw-r-- 1 gbase gbase 0 Oct 26 00:00 3.log
-rw-rw-r-- 1 gbase gbase 0 Oct 26 00:00 4.log
[gbase@rh6-1 sync_log]$ cd ..
[gbase@rh6-1 gbase]$ crontab -l
0 */2 * * * /opt/gnode/server/bin/gc_syncpacklog.sh /opt
[gbase@rh6-1 gbase]$ /opt/gnode/server/bin/gc_syncpacklog.sh /opt
[gbase@rh6-1 gbase]$ ll
total 28
-rw------- 1 gbase gbase   49 Oct 27 08:51 express.log
-rw------- 1 gbase gbase    5 Oct 27 08:51 gbased.pid
drwx------ 2 gbase gbase 4096 Oct 27 08:51 loader_logs
-rw------- 1 gbase gbase    0 Oct 27 08:51 loader_result.log
drwxr-xr-x 2 gbase gbase 4096 Oct 27 09:25 sync_log
-rw------- 1 gbase gbase 1987 Oct 27 09:21 syncserver.log
-rw------- 1 gbase gbase    4 Oct 27 08:51 syncserver.pid
-rw------- 1 gbase gbase  576 Oct 27 08:51 system.log
[gbase@rh6-1 gbase]$ ll sync_log/
total 4
-rw-rw-r-- 1 gbase gbase 170 Oct 27 09:25 2020-10-27_092538.tar.gz
[gbase@rh6-1 gbase]$