Atlas集成Hive

在安装好Atlas以后,如果想要使用起来,还要让Atlas与其他组件建立联系。

其中最常用的就是Hive。

通过Atlas的架构,只要配置好Hive Hook ,那么每次Hive做任何操作就会写入Kafka从而被atlas接收。

并在Atlas中已图的形式展示出来。

Hive Model

都会记录Hive哪些操作信息呢?Altas对Hive Model进行了定义。

包含以下内容:

1、实体类型:

hive_db

类型: Asset

属性:qualifiedName, name, description, owner, clusterName, location, parameters, ownerName

hive_table

类型:DataSet

属性:qualifiedName, name, description, owner, db, createTime, lastAccessTime, comment, retention, sd, partitionKeys, columns, aliases, parameters, viewOriginalText, viewExpandedText, tableType, temporary

hive_column

​ 类型:DataSet

​ 属性:qualifiedName, name, description, owner, type, comment, table

hive_storagedesc

​ 类型:Referenceable

​ 属性: qualifiedName, table, location, inputFormat, outputFormat, compressed, numBuckets, serdeInfo, bucketCols, sortCols, parameters, storedAsSubDirectories

hive_process

​ 类型:Process

​ 属性:qualifiedName, name, description, owner, inputs, outputs, startTime, endTime, userName, operationType, queryText, queryPlan, queryId, clusterName

hive_column_lineage

​ 类型:Process

​ 属性:qualifiedName, name, description, owner, inputs, outputs, query, depenendencyType, expression

2、枚举类型:

​ hive_principal_type 值:USER, ROLE, GROUP

3、构造类型

hive_order 属性: col, order

hive_serde 属性: name, serializationLib, parameters

HIve实体的结构:

hive_db.qualifiedName:     <dbName>@<clusterName>
hive_table.qualifiedName: <dbName>.<tableName>@<clusterName>
hive_column.qualifiedName: <dbName>.<tableName>.<columnName>@<clusterName>
hive_process.queryString: trimmed query string in lower case

配置Hive hook

hive hook会监听hive的 create/update/delete 操作,下面是配置步骤:

1、修改hive-env.sh(指定包地址)

export HIVE_AUX_JARS_PATH=/opt/apps/apache-atlas-2.1.0/hook/hive

2、修改hive-site.xml(配置完需要重启hive)

<property>
<name>hive.exec.post.hooks</name>
<value>org.apache.atlas.hive.hook.HiveHook</value>
</property>
1234

注意,这里其实是执行后的监控,可以有执行前,执行中的监控。

3、同步配置

拷贝atlas配置文件atlas-application.properties到hive配置目录

添加配置:

atlas.hook.hive.synchronous=false
atlas.hook.hive.numRetries=3
atlas.hook.hive.queueSize=10000
atlas.cluster.name=primary
atlas.rest.address=http://doit33:21000

将Hive元数据导入Atlas

bin/import-hive.sh

Using Hive configuration directory [/opt/module/hive/conf]

Log file for import is /opt/module/atlas/logs/import-hive.log

log4j:WARN No such property [maxFileSize] in org.apache.log4j.PatternLayout.

log4j:WARN No such property [maxBackupIndex] in org.apache.log4j.PatternLayout.

输入用户名:admin;输入密码:admin

Enter username for atlas :- admin

Enter password for atlas :-

Hive Meta Data import was successful!!!

踩坑全记录

一、找不到类 org.apache.atlas.hive.hook.hivehook

hive第三方jar包没加进去

小技巧 使用hive-shell 看一下jar包加进去没有 set这将打印由用户或配置单元覆盖的配置变量列表。

以加入elsaticsearch-hadoop-2.1.2.jar为例,讲述在Hive中加入第三方jar的几种方式。

1,在hive shell中加入

hive> add jar /home/hadoop/elasticsearch-hadoop-hive-2.1.2.jar;

连接方式 是否有效
Hive Shell 不需要重启Hive服务就有效
Hive Server 无效

2,Jar放入${HIVE_HOME}/auxlib目录

在${HIVE_HOME}中创建文件夹auxlib,然后将自定义jar文件放入该文件夹中。

此方法添加不需要重启Hive。而且比较便捷。

连接方式 是否有效
Hive Shell 不需要重启Hive服务就有效
Hive Server 重启Hive服务才生效

3,HIVE.AUX.JARS.PATH和hive.aux.jars.path

hive-env.sh中的HIVE.AUX.JARS.PATH和hive-site.xml的hive.aux.jars.path配置对服务器无效,仅对当前hive shell有效,不同的hive shell相互不影响,每个hive shell都需要配置,可以配置成文件夹形式。

HIVE.AUX.JARS.PATH和hive.aux.jars.path仅支持本地文件。可配置成文件,也可配置为文件夹。

连接方式 是否有效
Hive Shell 重启Hive服务才生效
Hive Server 重启Hive服务才生效
二、HIVE报错 Failing because I am unlikely to write too

HIVE.AUX.JARS.PATH配置不对

hive-env.sh脚本中有一段

# Folder containing extra libraries required for hive compilation/execution can be controlled by:
if [ "${HIVE_AUX_JARS_PATH}" != "" ]; then
export HIVE_AUX_JARS_PATH=${HIVE_AUX_JARS_PATH}
elif [ -d "/usr/hdp/current/hive-webhcat/share/hcatalog" ]; then
export HIVE_AUX_JARS_PATH=/usr/hdp/current/hive-webhcat/share/hcatalog
fi

如果给HIVE_AUX_JARS_PATH设值,则/usr/hdp/current/hive-webhcat/share/hcatalog就会被忽略掉。

hive只能读取一个HIVE_AUX_JARS_PATH

在一个地方集中放置我们的共享jar包,然后在/usr/hdp/current/hive-webhcat/share/hcatalog下面建立一相应的软连接就可以

sudo -u hive ln -s /usr/lib/share-lib/elasticsearch-hadoop-2.1.0.Beta4.jar /usr/hdp/current/hive-webhcat/share/hcatalog/elasticsearch-hadoop-2.1.0.Beta4.jar

了解大数据实时计算 感受数据流动之美 欢迎关注 实时流式计算

最新文章

  1. iOS 初步单元测试
  2. java基础知识回顾之---java StringBuffer,Stringbuilder与String的区别
  3. myeclipse自带客户端连接mysql数据库
  4. Codeforces Round #312 (Div. 2) B.Amr and The Large Array
  5. 【转】Android通过JNI调用驱动程序(完全解析实例)
  6. [转]ubuntu14.04安装好用的google拼音输入法
  7. Echarts动态数据显示
  8. QtSoap开发web services客户端程序
  9. 《Effective C++》:规定44-规定45
  10. p1217晚餐(简单的dijkstra)
  11. RPC-dubbo基本使用
  12. [Swift]LeetCode458. 可怜的小猪 | Poor Pigs
  13. 精读《React PowerPlug 源码》
  14. snprintf笔记
  15. 理解Docker镜像分层
  16. Vuejs——(1)入门(单向绑定、双向绑定、列表渲染、响应函数)
  17. SqlServer存储过程详解
  18. VMware vSphere中的HA工作原理介绍
  19. 【转】【VS Code】配置文件Launch及快捷键
  20. volatile 类型修饰符

热门文章

  1. Ecshop V2.7代码执行漏洞分析
  2. sqli-labs第5关布尔盲注pyhton脚本
  3. slice切片函数
  4. C# 将json字符串进行排序 转成键值
  5. Spring Boot 中使用 Quartz 实现任务调度
  6. [leetcode]108. Convert Sorted Array to Binary Search Tree构建二叉搜索树
  7. C# 9 新特性——init only setter
  8. Java学习日报7.29
  9. Linux常用文件类别
  10. 【老孟Flutter】Flutter 中与平台相关的生命周期