通过Kafka向Atlas中写入数据

Apache Atlas会在Kafka中创建两个Topic,分别为ATLAS_ENTITIES和ATLAS_HOOK,两个Topic的作用参考以下描述:
Apache Atlas sends notifications about metadata changes to Kafka topic named ATLAS_ENTITIES. Applications interested in metadata changes can monitor for these notifications.
Apache Atlas can be notified of metadata changes and lineage via notifications to Kafka topic named ATLAS_HOOK. Atlas hooks for Apache Hive/Apche HBase/Apache Sqoop/Apache Storm use this mechanism to notify Apche Atlas of events of interest.
利用console-consumer消费kafka指定topic,在hive中创建数据库,观察hook写入数据格式
创建数据库

hive> create database test;
OK
Time taken: 0.253 seconds

ATLAS_ENTITIESTopic的内容

{
    "version":{
        "version":"1.0.0",
        "versionParts":[
            1
        ]
    },
    "msgCompressionKind":"NONE",
    "msgSplitIdx":1,
    "msgSplitCount":1,
    "msgSourceIP":"192.168.2.11",
    "msgCreatedBy":"",
    "msgCreationTime":1593102598743,
    "message":{
        "type":"ENTITY_NOTIFICATION_V2",
        "entity":{
            "typeName":"hive_db",
            "attributes":{
                "owner":"root",
                "qualifiedName":"test@atlas-cluster",
                "clusterName":"atlas-cluster",
                "name":"test"
            },
            "guid":"ae01d981-53e9-4131-9f76-386f21f4b2be",
            "status":"ACTIVE",
            "displayText":"test"
        },
        "operationType":"ENTITY_CREATE",
        "eventTime":1593102595853
    }
}

ATLAS_HOOKTopic的内容

{
    "version":{
        "version":"1.0.0",
        "versionParts":[
            1
        ]
    },
    "msgCompressionKind":"NONE",
    "msgSplitIdx":1,
    "msgSplitCount":1,
    "msgSourceIP":"192.168.2.11",
    "msgCreatedBy":"root",
    "msgCreationTime":1593102595149,
    "message":{
        "type":"ENTITY_CREATE_V2",
        "user":"root",
        "entities":{
            "referredEntities":{

            },
            "entities":[
                {
                    "typeName":"hive_db",
                    "attributes":{
                        "owner":"root",
                        "ownerType":"USER",
                        "qualifiedName":"test@atlas-cluster",
                        "clusterName":"atlas-cluster",
                        "name":"test",
                        "description":null,
                        "location":"hdfs://mycluster/user/hive/warehouse/test.db",
                        "parameters":{

                        }
                    },
                    "guid":"-370041531563518",
                    "provenanceType":0,
                    "version":0,
                    "proxy":false
                }
            ]
        }
    }
}
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值