关于apache:Apache-Atlas入门

26次阅读

共计 7017 个字符,预计需要花费 18 分钟才能阅读完成。

Apache Atlas 介绍

Apache Atlas 是托管于 Apache 旗下的一款元数据管理和治理的产品,Apache Atlas 提供 api 和一系列插件能够不便将数据库元数据信息导入到 atlas 中进行剖析,atlas 也提供 web 界面对元数据进行治理,通过 atlas,企业能够对数据库元数据建设资产目录,并对这些资产进行分类和治理,为数据分析,数据治理提供高质量的元数据信息。

什么是元数据

企业外部可能运行多种类型数据库,从大类上能够分,大数据平台,sql 数据库,nosql 数据库,图数据库等,从具体的数据库类型可能是 mysql,oracle,mongodb 等,不论是什么类型的数据库,终归都是一个目标,存储数据,对怎么治理数据每个数据库有每个数据库的形式,以 oracle 为例

  • schema 是一组数据库对象的汇合
  • table 是存储数据的实体
  • column 列示意数据库的每个属性
  • view 视图示意虚构表,示意一组查问的逻辑汇合
  • materialview 物化视图则是对视图的实体化
  • 同义词示意数据库对象的别名
  • … 等等

那么 schema,table,column 这些形容数据的信息就是元数据,元数据库治理有什么用,咱们平时做开发可能很少会去思考这个问题,元数据管理对保障数据库品质是十分重要的,通过元数据管理

  • 剖析表,视图等数据库对象间的依赖关系
  • 剖析字段间的传递关系,在元数据库治理中,咱们称之为数据血缘关系
  • 剖析是否存在反复字段,矛盾字段等
  • 为企业提供数据地图

每个业务零碎可能会本人定义表,视图,这些数据从哪来又流往哪去,数据之间是否存在关联,和其余零碎的数据是否存在反复字段和矛盾字段,这些就是元数据管理要解决的问题。

apache atlas 装置

Atlas 目前只能自行编译源码进行装置,Atlas 应用 java 开发,然而是以 python 形式启动,所以装置之前,环境必须满足以下需要

  • jdk 1.8+
  • maven3.x
  • python2.7+

你能够从这里下载最新版本的 Atlas 代码,以 2.1.0 版本为例

$ tar -xvf apache-atlas-2.1.0-sources.tar.gz
$ cd apache-atlas-sources-2.1.0
$ mvn clean install
$ mvn clean -DskipTests package -Pdist,embedded-hbase-solr

装置相干依赖的过程可能会很长,有多长呢,大略一天左右吧,有时候还要迷信上下网能力下载下来,所以这货色不适宜急性子的人把玩

如果你看到了以下输入,祝贺你装置胜利

INFO] Reactor Summary:
[INFO] 
[INFO] Apache Atlas Server Build Tools 1.0 ................ SUCCESS [0.904 s]
[INFO] apache-atlas 2.1.0 ................................. SUCCESS [7.481 s]
[INFO] Apache Atlas Test Utility Tools 2.1.0 .............. SUCCESS [6.085 s]
[INFO] Apache Atlas Integration 2.1.0 ..................... SUCCESS [7.561 s]
[INFO] Apache Atlas Common 2.1.0 .......................... SUCCESS [3.016 s]
[INFO] Apache Atlas Client 2.1.0 .......................... SUCCESS [0.334 s]
[INFO] atlas-client-common 2.1.0 .......................... SUCCESS [1.254 s]
[INFO] atlas-client-v1 2.1.0 .............................. SUCCESS [1.706 s]
[INFO] Apache Atlas Server API 2.1.0 ...................... SUCCESS [2.309 s]
[INFO] Apache Atlas Notification 2.1.0 .................... SUCCESS [4.108 s]
[INFO] atlas-client-v2 2.1.0 .............................. SUCCESS [1.118 s]
[INFO] Apache Atlas Graph Database Projects 2.1.0 ......... SUCCESS [0.202 s]
[INFO] Apache Atlas Graph Database API 2.1.0 .............. SUCCESS [1.349 s]
[INFO] Graph Database Common Code 2.1.0 ................... SUCCESS [1.351 s]
[INFO] Apache Atlas JanusGraph-HBase2 Module 2.1.0 ........ SUCCESS [1.747 s]
[INFO] Apache Atlas JanusGraph DB Impl 2.1.0 .............. SUCCESS [6.776 s]
[INFO] Apache Atlas Graph DB Dependencies 2.1.0 ........... SUCCESS [1.730 s]
[INFO] Apache Atlas Authorization 2.1.0 ................... SUCCESS [1.990 s]
[INFO] Apache Atlas Repository 2.1.0 ...................... SUCCESS [13.068 s]
[INFO] Apache Atlas UI 2.1.0 .............................. SUCCESS [44.313 s]
[INFO] Apache Atlas New UI 2.1.0 .......................... SUCCESS [42.839 s]
[INFO] Apache Atlas Web Application 2.1.0 ................. SUCCESS [01:13 min]
[INFO] Apache Atlas Documentation 2.1.0 ................... SUCCESS [1.562 s]
[INFO] Apache Atlas FileSystem Model 2.1.0 ................ SUCCESS [2.956 s]
[INFO] Apache Atlas Plugin Classloader 2.1.0 .............. SUCCESS [1.284 s]
[INFO] Apache Atlas Hive Bridge Shim 2.1.0 ................ SUCCESS [2.836 s]
[INFO] Apache Atlas Hive Bridge 2.1.0 ..................... SUCCESS [7.575 s]
[INFO] Apache Atlas Falcon Bridge Shim 2.1.0 .............. SUCCESS [1.455 s]
[INFO] Apache Atlas Falcon Bridge 2.1.0 ................... SUCCESS [2.289 s]
[INFO] Apache Atlas Sqoop Bridge Shim 2.1.0 ............... SUCCESS [0.244 s]
[INFO] Apache Atlas Sqoop Bridge 2.1.0 .................... SUCCESS [5.200 s]
[INFO] Apache Atlas Storm Bridge Shim 2.1.0 ............... SUCCESS [0.695 s]
[INFO] Apache Atlas Storm Bridge 2.1.0 .................... SUCCESS [2.701 s]
[INFO] Apache Atlas Hbase Bridge Shim 2.1.0 ............... SUCCESS [1.547 s]
[INFO] Apache Atlas Hbase Bridge 2.1.0 .................... SUCCESS [5.306 s]
[INFO] Apache HBase - Testing Util 2.1.0 .................. SUCCESS [2.853 s]
[INFO] Apache Atlas Kafka Bridge 2.1.0 .................... SUCCESS [2.156 s]
[INFO] Apache Atlas classification updater 2.1.0 .......... SUCCESS [0.955 s]
[INFO] Apache Atlas Impala Hook API 2.1.0 ................. SUCCESS [0.252 s]
[INFO] Apache Atlas Impala Bridge Shim 2.1.0 .............. SUCCESS [0.245 s]
[INFO] Apache Atlas Impala Bridge 2.1.0 ................... SUCCESS [3.901 s]
[INFO] Apache Atlas Distribution 2.1.0 .................... SUCCESS [01:08 h]
  • 启动
$ cd apache-atlas-sources-2.1.0/distro/target/apache-atlas-2.1.0-server/apache-atlas-2.1.0/bin
$ python atlas_start.py

configured for local hbase.
hbase started.
configured for local solr.
solr started.
setting up solr collections...
starting atlas on host localhost
starting atlas on port 21000
..............................
Apache Atlas Server started!!!

在浏览器关上 http://localhost:21000/ 如果你看到以下画面,阐明启动胜利

  • 登录

默认用户名和明码是admin/admin,登录后页面

装置示例(quick start)

Atlas 安装包中提供两个我的项目的示例,如果你是想学习,这两个示例是很好的入门

$ cd apache-atlas-sources-2.1.0/distro/target/apache-atlas-2.1.0-server/apache-atlas-2.1.0/bin
$ python quick_start.py
$ python quick_start_v1.py

示例装置完登录 http://localhost:21000 就能查问到两个示例到元数据信息

相干概念

  • 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 咱们能够清晰的晓得数据的从何而来又流向何处,两头通过了哪些操作

UI 界面

  • Entity 主界面

这里能够查看 Entity 详细信息,能够查看和增加分类,术语,查看和定义一些属性,标签

  • 血缘关系

sales_fact 通过 loadSalesDaily 操作后生成表 sales_fact_daily_mv,再通过loadSalesMonthly 后生成表 sales_fact_monthly_mv,咱们能够看下sales_fact_monthly_mv 的血统图,能够发现该表源头数据不仅来自 sales_fact 还来自于 time_dim

  • 关联关系

能够查问表蕴含的列,数据库,起源,去向,存储,点击下面切换视图能够切换到图形模式

  • 审计线索

记录对该对象的操作记录

导入 hive 表

atlas 能够通过 brige 将元数据从数据库系统导入到 atlas 中,并且反对自动更新,目前从源码上看 atlas 反对的产品如下

$ ll apache-atlas-sources-2.1.0/addons/

drwxr-xr-x@  6 asan  staff   192 Jan 21 15:47 falcon-bridge/
drwxr-xr-x@  6 asan  staff   192 Jan 21 15:47 falcon-bridge-shim/
drwxr-xr-x@  6 asan  staff   192 Jan 21 15:47 hbase-bridge/
drwxr-xr-x@  6 asan  staff   192 Jan 21 15:47 hbase-bridge-shim/
drwxr-xr-x@  6 asan  staff   192 Jan 21 15:47 hbase-testing-util/
drwxr-xr-x@  5 asan  staff   160 Jan 21 15:47 hdfs-model/
drwxr-xr-x@  6 asan  staff   192 Jan 21 15:47 hive-bridge/
drwxr-xr-x@  6 asan  staff   192 Jan 21 15:47 hive-bridge-shim/
drwxr-xr-x@  6 asan  staff   192 Jan 21 15:47 impala-bridge/
drwxr-xr-x@  6 asan  staff   192 Jan 21 15:47 impala-bridge-shim/
drwxr-xr-x@  6 asan  staff   192 Jan 21 15:47 impala-hook-api/
drwxr-xr-x@  6 asan  staff   192 Jan 21 15:47 kafka-bridge/
drwxr-xr-x@  7 asan  staff   224 Jul 10  2020 models/
drwxr-xr-x@  6 asan  staff   192 Jan 21 15:47 sqoop-bridge/
drwxr-xr-x@  6 asan  staff   192 Jan 21 15:47 sqoop-bridge-shim/
drwxr-xr-x@  6 asan  staff   192 Jan 21 15:47 storm-bridge/
drwxr-xr-x@  6 asan  staff   192 Jan 21 15:47 storm-bridge-shim/

能够看到目前反对 falcon,hbase,hive,impala,kafka,sqoop,storm 数据库的导入,并且 atlas 自带有 hive 相干元数据类型

  • 配置 hive-site.xml
<property>
    <name>hive.exec.post.hooks</name>
    <value>org.apache.atlas.hive.hook.HiveHook</value>
</property>
  • 批改 hive-env.sh
export HIVE_AUX_JARS_PATH=/home/asan/apache-atlas-sources-2.1.0/distro/target/apache-atlas-2.1.0-hive-hook/apache-atlas-hive-hook-2.1.0/hook/hive
  • 启动 import-hive.sh 脚本
cd apache-atlas-sources-2.1.0/distro/target/apache-atlas-2.1.0-hive-hook/apache-atlas-hive-hook-2.1.0/hook-bin
./import-hive.sh
  • 显示以下后果阐明导入胜利
Enter username for atlas :- admin
Enter password for atlas :- 
Hive Meta Data imported successfully!!!

参考文档

  • https://manjitsingh664.medium.com/apache-atlas-installation-guide-9098df98d5c3

正文完
 0