Apache Atlas2.1.0 集成Hive元数据管理

2 篇文章 0 订阅
Atlas里的相关概念
  • Type
    元数据类型定义,这里可以是表,列,视图,物化视图等,还可以细分hive表(hive_table),hbase表(hbase_table)等,甚至可以是一个数据操作行为,比如定时同步从一张表同步到另外一张表这个也可以描述为一个元数据类型,atlas自带了很多类型,但是可以通过调用api自定义类型

  • Classification
    分类,通俗点就是给元数据打标签,分类是可以传递的,比如user_view这个视图是基于user这个表生成的,那么如果user打上了HR这个标签,user_view也会自动打上HR的标签,这样的好处就是便于数据的追踪

  • GLOSSARY
    词汇表,GLOSSARY包含两个概念,Category(类别)和Term(术语),Category表示一组Term的集合,术语为元数据提供了别名,以便用户更好的理解数据,举个例子,有个pig的表,里面有个猪肾的字段,但很多人更习惯叫做猪腰子,那么就可以给猪肾这个字段加一个Term,不仅更好理解,也更容易搜索到

  • Entity
    实体,表示具体的元数据,Atlas管理的对象就是各种Type的Entity

  • Lineage
    数据血缘,表示数据之间的传递关系,通过Lineage我们可以清晰的知道数据的从何而来又流向何处,中间经过了哪些操作

集成 hive 3.1.2 版本

官方doc:
http://atlas.apache.org/2.1.0/index.html#/HookHive

  • 配置 Hive Hook
    Atlas Hive hook registers with Hive to listen for create/update/delete operations and updates the metadata in Atlas, via Kafka notifications, for the changes in Hive. Follow the instructions below to setup Atlas hook in Hive
    在集群的hive hive-site.xml 中添加 hive.exec.post.hooks 参数 ,每个hive任务执行后 均会执行该钩子 默认空
    采集以下hive操作:
    • create database
    • create table/view, create table as select
    • load, import, export
    • DMLs (insert)
    • alter database
    • alter table (skewed table information, stored as, protection is not supported)
    • alter view
<property>
    <name>hive.exec.post.hooks</name>
      <value>org.apache.atlas.hive.hook.HiveHook</value>
  </property>
  • hive-env.sh 修改
# hive-env.sh 中添加 
export HIVE_AUX_JARS_PATH=<atlas package>/hook/hive
  • atlas-application.properties 添加
#移动 atlas-application.properties 
/data/software/apache-atlas-sources-2.1.0/distro/target/apache-atlas-2.1.0-bin/apache-atlas-2.1.0/conf/
下的 atlas-application.properties 放置在 hive /conf/目录下
  • 导入hive 元数据
# 执行当前目录下的 import-hive.sh
/data/software/apache-atlas-sources-2.1.0/distro/target/apache-atlas-2.1.0-hive-hook/apache-atlas-hive-hook-2.1.0/hook-bin
  • atlas 页面 hive 元数据展示

在这里插入图片描述

  • hive 表血缘关系展示
    在hive 客户端 执行以下hive作业,
insert overwrite  table project_statistics
select
	p.city_code,
	a.name as city_name,
	sum(b.real_amt) as real_amt,
	sum(b.real_number) as real_number
from project p 
left join area a on p.city_code = a.code 
join salary_batch b on p.id = b.id 
group by p.city_code,a.name;

在这里插入图片描述
以上图示, project area salary_batch 三张表 经过 hive op操作 最终形成 project_statistics 表

  • hive表 字段血缘关系管理

在这里插入图片描述

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值