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_ENTITIES
Topic的内容
{
"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_HOOK
Topic的内容
{
"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
}
]
}
}
}