返回首页

gbase数据、南大通用产品文档:GBase8sGCIDateTimeAssign

更新日期:2024年09月11日



sword GCIDateTimeAssign (
void *hndl,
GCIError *err,
const GCIDateTime *from,
GCIDateTime *to
);

两个日期时间变量的赋值。

参数
输入
/输出


hndl
输入
用户会话句柄或环境句柄,在此函数中不做验证
err
输入
错误信息句柄, 该接口调用失败时, 错误信息会存在该句柄上
from
输入
复制操作数据源
to
输出
复制操作目的地

如果执行成功, 返回GCI_SUCCESS,否则返回GCI_ERROR。

使用指导
用户可通过gs_dbmind命令启动对应的exporter。
下面为用户演示一个完整的Prometheus
监控平台的搭建过程。
步骤1 部署openGauss-exporter
启动openGauss-exporter,采用默认侦听端口号9187,侦听地址为192.168.1.100,不采
用https 协议,则命令可以为:
gs_dbmind component opengauss_exporter --url postgresql://user:password@ip:port/dbname
--web.listen- address 192.168.1.100 --disable-https
步骤2 部署reprocessing-exporter
启动reprocessing-exporter,采用默认侦听端口号8181,侦听地址为192.168.1.101,
Prometheus-server IP 与端口号为192.168.1.100:9090,采用https 协议,则命令可以为:
gs_dbmind component reprocessing_exporter 192.168.1.100 9090 --web.listen-address

基于WDR Snapshot 数据表汇总、统计,生成性能报告,默认初始化用户或监控管理员

GBase 8c V5 开发者手册
南大通用数据技术股份有限公司
1086
用户可以生成报告,在V500R001C20SPC003 之前的版本初始化用户或者sysadmin 用户可
以生成报告。
前提条件
WDR Snasphot 启动(即参数enable_wdr_snapshot 为on 时),且快照数量大于等于2。
操作步骤
1、执行如下命令新建报告文件。
touch
/home/om/wdrTestNode.html
2、执行以下命令连接postgres 数据库。
gsql -d postgres -p 端口号-r
3、执行如下命令查询已经生成的快照,以获取快照的snapshot_id。
select * from snapshot.snapshot;
4、
(可选)在CCN 上执行如下命令手动创建快照。数据库中只有一个快照或者需要查
看在当前时间段数据库的监控数据,可以选择手动执行快照操作,该命令需要用户具有
sysadmin 权限。
select create_wdr_snapshot();
说明:执行“cm_ctl query -Cdvi”,回显中“Central Coordinator State”下显示的
信息即为CCN 信息。
5、执行如下命令,在本地生成HTML 格式的WDR 报告。

执行如下命令,设置报告格式。\a: 不显示表行列符号,\t: 不显示列名,\o: 指
定输出文件。
gsql> \a
gsql> \t
gsql> \o /home/om/wdrTestNode.html

执行如下命令,生成HTML 格式的WDR 报告。
gsql> select generate_wdr_report(begin_snap_id Oid, end_snap_id Oid, int report_type, int
report_scope, int node_name );

GBase 8c V5 开发者手册
南大通用数据技术股份有限公司
1087
示例一,生成集群级别的报告:
select generate_wdr_report(1, 2, 'all', 'cluster',null);
示例二,生成某个节点的报告:
select generate_wdr_report(1, 2, 'all', 'node', pgxc_node_str()::cstring);
说明:当前GBase 8c 的节点名固定是“dn_6001_6002_6003”,也可直接代入。
表generate_wdr_report 函数参数说明
参数
说明
取值范围
begin_snap_id
查询时间段开始的snapshot
的id(表snapshot.snaoshot
中的snapshot_id)。
-
end_snap_id
查询时间段结束snapshot
的id。默认end_snap_id 大
于begin_snap_id(表snaps
hot.snaoshot 中的snapshot_i
d)。
-
report_type
指定生成report 的类型。

如,summary/detail/all。
summary:汇总数据。
detail:明细数据。
all:包含summary 和detail。
report_scope
指定生成report 的范围,

以为cluster 或者node。
cluster:数据库级别的信息。
node:节点级别的信息。
node_name
在report_scope 指定为node
时,
需要把该参数指定为对
应节点的名称。
(节点名称
可以执行select * from pg
_node_env;查询)。
在report_scope 为cluster
时,
该值可以省略或者指定
为空或NULL。
node:
GBase 8c 中的节点名
称。
cluster:省略/空/NULL。

执行如下命令关闭输出选项及格式化输出命令。
\o \a \t

GBase 8c V5 开发者手册
南大通用数据技术股份有限公司
1088
6、在/home/om/下根据需要查看WDR 报告。
示例
--创建报告文件
touch
/home/om/wdrTestNode.html
--连接数据库
gsql -d postgres -p 端口号-r
--查询已经生成的快照。
postgres=# select * from snapshot.snapshot;
snapshot_id |
start_ts
|
end_ts
-------------+-------------------------------+-------------------------------
1 | 2020-09-07 10:20:36.763244+08 | 2020-09-07 10:20:42.166511+08
2 | 2020-09-07 10:21:13.416352+08 | 2020-09-07 10:21:19.470911+08
(2 rows)
--生成格式化性能报告wdrTestNode.html。
postgres=# \a \t \o /home/om/wdrTestNode.html
Output format is unaligned.
Showing only tuples.
--向性能报告wdrTestNode.html 中写入数据。
postgres=# select generate_wdr_report(1, 2, 'all', 'node', 'dn_6001_6002_6003');
--关闭性能报告wdrTestNode.html。
postgres=# \o
--生成格式化性能报告wdrTestCluster.html。
postgres=# \o /home/om/wdrTestCluster.html

GBase 8c V5 开发者手册
南大通用数据技术股份有限公司
1089
--向格式化性能报告wdrTestCluster.html 中写入数据。
postgres=# select generate_wdr_report(1, 2, 'all', 'cluster');
--关闭性能报告wdrTestCluster.html。
postgres=# \o \a \t
Output format is aligned.
Tuples only is off.