普元数据资产管理平台 普元数据资产管理平台
  • 7.1GA
  • 7.1.1GA
  • 7.2GA
  • 7.3GA
产品简介
快速开始
安装指南
数据资产及目录
数据标准
数据模型
元数据管理
数据服务
数据安全
常见问题解答
开发指南
更新日志
  • 样例数据采集工具-使用与扩展
  • 一、使用方式
  • 1.初始化数据库(初始化到资产数据库中)
  • 2.修改配置文件
  • 3.启动应用
  • 二、如何生成数据
  • 1.启动触发
  • 2.定时触发
  • 3.手动触发
  • 三、扩展配置
  • 1.damcollectproperty(采集配置表)
  • 2.damcollectproperty_template(采集配置模板表)

# 样例数据采集工具-使用与扩展

# 一、使用方式

# 1.初始化数据库(初始化到资产数据库中)

初始化表语句,以 MySQL 为例,初始化到部署资产的数据库 damp731 中:

    create table dam_collect_property
    (
        id            char(36)     not null comment 'id'
            primary key,
        ds_id         varchar(255) not null comment '数据源',
        table_name    varchar(255) not null comment '表名',
        schema_name   varchar(256) null comment 'schema名称',
        size          int          not null comment '采集数量',
        mode          varchar(255) not null comment '采集方式(数据库/生成)',
        is_collect    tinyint(1)   not null comment '是否采集',
        is_update     tinyint(1)   not null comment '是否更新',
        masked_fields varchar(255) null comment '脱敏字段'
    ) comment '采集配置表' charset = utf8mb4;

    create table dam_collect_property_template
    (
        id           char(36)     not null comment 'id'
            primary key,
        size         int          not null comment '采集数量',
        mode         varchar(255) not null comment '采集方式',
        isCollect    tinyint(1)   not null comment '是否采集',
        isUpdate     tinyint(1)   not null comment '是否更新',
        maskedFields varchar(255) null comment '脱敏字段'
    ) comment '采集配置模板' charset = utf8mb4;
INSERT INTO dam_collect_property_template (id, size, mode, isCollect, isUpdate, maskedFields) VALUES ('logic', 10, 'create', 1, 0, null);
INSERT INTO dam_collect_property_template (id, size, mode, isCollect, isUpdate, maskedFields) VALUES ('metacube', 10, 'datasource', 1, 0, null);

# 2.修改配置文件

修改采集器的 /home/primeton/extractor/config/EXTRACTOR/config/user-config.xml 中数据库配置,需要修改 default(资产库)和 metacube(元数据库)的数据库连接配置:

<module name="DataSource">
        <!-- 部署资产所连接的数据库 -->
        <group name="default">
            <configValue key="Database-Type">MySql</configValue>
            <configValue key="Jdbc-Type"/>
            <configValue key="C3p0-DriverClass">com.mysql.jdbc.Driver</configValue>
            <configValue key="C3p0-Url">jdbc:mysql://127.0.0.1:3306/damp731?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&useSSL=false</configValue>
            <configValue key="C3p0-UserName">root</configValue>
            <configValue key="C3p0-Password">{3DES}GW8In7jcvWFfommGUDfwQuo=</configValue>
            <configValue key="C3p0-PoolSize">10</configValue>
            <configValue key="C3p0-MaxPoolSize">50</configValue>
            <configValue key="C3p0-MinPoolSize">10</configValue>
            <configValue key="C3p0-MaxIdleTime">600</configValue>
            <configValue key="C3p0-IdleConnectionTestPeriod">900</configValue>
            <configValue key="C3p0-MaxStatements">0</configValue>
            <configValue key="C3p0-NumHelperThreads">1</configValue>
            <configValue key="Transaction-Isolation">ISOLATION_DEFAULT</configValue>
            <configValue key="Test-Connect-Sql">SELECT count(*) from EOS_UNIQUE_TABLE</configValue>
            <configValue key="Retry-Connect-Count">-1</configValue>
        </group>
        <!-- 部署元数据所连接的数据库 -->
        <group name="metacube">
            <configValue key="Database-Type">MySql</configValue>
            <configValue key="Jdbc-Type"/>
            <configValue key="C3p0-DriverClass">com.mysql.jdbc.Driver</configValue>
            <configValue key="C3p0-Url">jdbc:mysql://127.0.0.1:3306/intergration75?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&useSSL=false</configValue>
            <configValue key="C3p0-UserName">root</configValue>
            <configValue key="C3p0-Password">{3DES}/QLD+vEGAJ8sf8q+VVSPODQ=</configValue>
            <configValue key="C3p0-PoolSize">10</configValue>
            <configValue key="C3p0-MaxPoolSize">50</configValue>
            <configValue key="C3p0-MinPoolSize">10</configValue>
            <configValue key="C3p0-MaxIdleTime">600</configValue>
            <configValue key="C3p0-IdleConnectionTestPeriod">900</configValue>
            <configValue key="C3p0-MaxStatements">0</configValue>
            <configValue key="C3p0-NumHelperThreads">1</configValue>
            <configValue key="Transaction-Isolation">ISOLATION_DEFAULT</configValue>
            <configValue key="Test-Connect-Sql">SELECT count(*) from EOS_UNIQUE_TABLE</configValue>
            <configValue key="Retry-Connect-Count">-1</configValue>
        </group>
    </module>

# 3.启动应用

[root@localhost extractor]# pwd
/home/primeton/extractor
[root@localhost extractor]# ./bin/startup.sh

# 二、如何生成数据

# 1.启动触发

启动应用后如果 dam_collect_property 中没有数据,会自动开始样例数据生成功能。

# 2.定时触发

/home/primeton/extractor/config/application.properties 中含有定时配置,开启并配置所需 cron 表达式即可。

damp.extractor.schedule.enable=false
damp.extractor.schedule.cron=0 0 0 * * ?

# 3.手动触发

通过调用系统接口方式触发,调用时需要在 header 头中添加 Authorization 参数和 Content-Type 参数。

  • 生成样例数据配置 。 POST /damp/extend/createProperties

  • 生成发布资产对应的配置,会根据配置模板表生成所有已经发布资产的生成配置 。 POST /damp/extend/createData

传参生成对应资产的样例数据,若不传参数,则对所有资产数据进行生成。

{
  "property": {
    "id": "1882"
  }
}

# 三、扩展配置

# 1.dam_collect_property(采集配置表)

字段 备注
id 资产 ID 对应 RCM_CATALOG 表中 CATA_ID
ds_id 数据源 ID 对应 RCM_DATASOURCE 表中 DS_ID
table_name 表名
size 每个资产生成样例数据条数
mode 生成方式,datasource(查数据库),create(随机生成,现在就是****)
isCollect 是否采集
isUpdate 是否更新
maskedFields 脱敏字段配置(格式为 字段编码用逗号分隔),现在脱敏默认****

# 2.dam_collect_property_template(采集配置模板表)

生成资产配置时的默认配置的表.

字段 备注
id 模板类型(metacube/logic)
size 采集数量
mode 采集方式
isCollect 是否采集
isUpdate 是否更新
maskedFields 脱敏字段
上次更新: 2024/8/8上午9:40:04

← 扩展加密算法 资产低开流程配置开发说明 →