ImageVerifierCode 换一换
格式:DOCX , 页数:22 ,大小:286.29KB ,
资源ID:25192002      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/25192002.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(apache atlas工作实践实例.docx)为本站会员(b****9)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

apache atlas工作实践实例.docx

1、apache atlas工作实践实例Apache atlas 的入门教程其实,在本人之前的文章中有介绍,它是一个用在hadoop上的数据治理和元数据框架工具。它是基于hadoop平台上,能无缝对接hadoop平台的组件。前端UI默认使用solr5,有丰富的rest API ,后端数据库可以是hive,hbase等。能导入不同格式的数据源,包括hive,hbase等(传统数据库,暂不清楚)。1.Apache atlas 安装安装步骤,官网上面有,链接:https:/atlas.apache.org/InstallationSteps.html为方便操作,简单翻译一下步骤:环境:JDK8MAVEN

2、3.XGITPYTHON2.7以上(1)building atlas(构建atlas)git clone https:/git-wip-us.apache.org/repos/asf/atlas.git atlascd atlasexport MAVEN_OPTS=-Xms2g -Xmx4gmvn clean -DskipTests install1234注意:服务器内存至少要4G。笔者升级了几次配置。这是笔者的截图:文件很多,要下比较1-2个小时,中间可能也有fail。(2)打包atlas(机器上已经装有hbase和solr)mvn clean -DskipTests package -Pd

3、ist1(机器上没有装hbase和solr,atlas自带hbase和solr)mvn clean -DskipTests package -Pdist,embedded-hbase-solr1本文这里选了后一种。(3)打包完,会在根目录下生成以下的包:(4)安装atlastar -xzvf apache-atlas-$project.version-bin.tar.gzcd atlas-$project.version123目前它会自动解压,这一步可以不要。下载完成后,目录结构:其中,atlas_home/distro/target 下面,apache-atlas-1.0.0-SNAPSHO

4、T-bin 是其解压后的目录:注意:接下来是配置步骤。先看完黑体字,再接着看下文。如果只是atlas默认配置启动,命令:cd /apache_atlas/atlas/distro/target/apache-atlas-1.0.0-SNAPSHOT-bin/apache-atlas-1.0.0-SNAPSHOTbin/atlas_start.py12测试:curl -v http:/localhost:21000/api/atlas/admin/version报错:Error 401 Full authentication is required to access this resource

5、HTTP ERROR 401Problem accessing /api/atlas/admin/version. Reason:Full authentication is required to access this resource原因:没有权限,正确命令:curl -v -u username:password http:/localhost:21000/api/atlas/admin/versionusername:默认adminpassword:默认admincurl -v -u admin:admin http:/localhost:21000/api/atlas/admin/

6、version这样就成功了。上面的启动,solr,hbase 是内嵌式的,solr端口是9838,跟独立安装的默认端口8983不一样。如果需要自定义配置,尤其是使用hbase做图库的存储后端(HBase as the Storage Backend for the Graph Repository),solr做图表库的索引后端(SOLR as the Indexing Backend for the Graph Repository),请看下文。(5)配置项。conf/atlas-env.sh# The java implementation to use. If JAVA_HOME is n

7、ot found we expect java and jar to be in path#export JAVA_HOME=# any additional java opts you want to set. This will apply to both client and server operations#export ATLAS_OPTS=# any additional java opts that you want to set for client only#export ATLAS_CLIENT_OPTS=# java heap size we want to set f

8、or the client. Default is 1024MB#export ATLAS_CLIENT_HEAP=# any additional opts you want to set for atlas service.#export ATLAS_SERVER_OPTS=# java heap size we want to set for the atlas server. Default is 1024MB#export ATLAS_SERVER_HEAP=# What is is considered as atlas home dir. Default is the base

9、location of the installed software#export ATLAS_HOME_DIR=# Where log files are stored. Defatult is logs directory under the base install location#export ATLAS_LOG_DIR=# Where pid files are stored. Defatult is logs directory under the base install location#export ATLAS_PID_DIR=# Where do you want to

10、expand the war file. By Default it is in /server/webapp dir under the base install dir.#export ATLAS_EXPANDED_WEBAPP_DIR=1234567891011121314151617181920212223242526272829如果/etc/profile没有配JAVA_HOME,需要配JAVA_HOME。配置conf/atlas-application.properties:#使用hbase tablesatlas.graph.storage.hbase.table=atlasat

11、las.audit.hbase.tablename=apache_atlas_entity_audit123这一步,需要安装独立的solr集群,使用zookeeper是solr集群高可用。参考链接:https:/cwiki.apache.org/confluence/display/solr/SolrCloud启动solr集群:cd solr/bin./solr create -c vertex_index -d SOLR_CONF -shards #numShards -replicationFactor #replicationFactor./solr create -c edge_ind

12、ex -d SOLR_CONF -shards #numShards -replicationFactor #replicationFactor./solr create -c fulltext_index -d SOLR_CONF -shards #numShards -replicationFactor #replicationFactor123SOLR_CONF : solrconfig.xml所在的目录,其实笔者之前也一直没有搞清楚。笔者这里是:/usr/local/solr-5.5.1如果不知道要创建多少numShards ,可忽略,默认是1。笔者的配置如下:cd /apache_a

13、tlas/atlas/distro/target/solr/binexport SOLR_CONF=/usr/local/solr-5.5.1./solr start -c -z localhost:2181 -p 8983./solr create -c vertex_index -d $SOLR_CONF./solr create -c edge_index -d $SOLR_CONF./solr create -c fulltext_index -d $SOLR_CONF123456启动solr集群后,在atlas-application.properties中配置:#atlas.kaf

14、ka.zookeeper.connect=localhost:2181atlas.graph.index.search.backend=solr5atlas.graph.index.search.solr.mode=cloudatlas.graph.index.search.solr.zookeeper-url=10.1.6.4:2181,10.1.6.5:2181atlas.graph.index.search.solr.zookeeper-connect-timeout=60000 msatlas.graph.index.search.solr.zookeeper-session-time

15、out=60000 ms1234567启动hbase:cd hbase/bin./start-hbase.sh1启动atlas:bin/atlas_start.py1atlas UI界面:http:/localhost:21000/1错误1:java.io.FileNotFoundException: /apache_atlas/atlas/distro/target/server/webapp/atlas.war (No such file or directory) at java.io.FileInputStream.open0(Native Method) at java.io.Fil

16、eInputStream.open(FileInputStream.java:195) at java.io.FileInputStream.(FileInputStream.java:138) at java.io.FileInputStream.(FileInputStream.java:93) at sun.tools.jar.Main.run(Main.java:307) at sun.tools.jar.Main.main(Main.java:1288)The Server is no longer running with pid 6353configured for local

17、hbase.hbase started.configured for local solr.solr started.setting up solr collections.starting atlas on host localhoststarting atlas on port 21000123456789101112131415这是atlas启动的路径不对导致。网上没有该解决方法。后来发现启动的路径不对,笔者这里,之前启动路径是:/apache_atlas/atlas/distro/target/正确的启动路径是:/apache_atlas/atlas/distro/target/apa

18、che-atlas-1.0.0-SNAPSHOT-bin/apache-atlas-1.0.0-SNAPSHOT/错误2:/apache_atlas/atlas/distro/target/logs 错误日志会有:ERROR: Collection vertex_index already exists!Checked collection existence using Collections API command:http:/localhost:9838/solr/admin/collections?action=list1234这是重名collection冲突。命令:jps看看是否有多

19、个jar进程。该进程是solr进程。希望别人不要犯跟我一样的错误。错误3:2018-05-05 11:10:18,545 WARN - main: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name services: Invocation of init method failed; nested except

20、ion is java.lang.RuntimeException: org.apache.atlas.AtlasException: Failed to start embedded kafka (AbstractApplicationContext:550)2018-05-05 11:10:18,699 ERROR - main: Context initialization failed (ContextLoader:350)org.springframework.beans.factory.BeanCreationException: Error creating bean with

21、name services: Invocation of init method failed; nested exception is java.lang.RuntimeException: org.apache.atlas.AtlasException: Failed to start embedded kafka123Caused by: org.apache.atlas.AtlasException: Failed to start embedded kafka at org.apache.atlas.kafka.EmbeddedKafkaServer.start(EmbeddedKa

22、fkaServer.java:83) at org.apache.atlas.service.Services.start(Services.java:67) . 40 moreCaused by: .BindException: Address already in use12345原因:端口占用。查看conf/atlas-application.propertiesatlas.kafka.zookeeper.connect=localhost:*端口是否占用。简单说了下atlas安装,接下来说下使用方式。2.Apache atlas 使用方式再说下rest api的使用方式。需要关注的地方

23、:Apache atlas Api主要是对Type,Entity,Attribute这3个构件的增删改查操作。这听起来有点意外,实际上,其它的很多东西被封装了,还有包含在配置文件里,留下Api和Admin UI供外部调用。简单介绍一下这几个构件。Type:Atlas 中的 “类型” 是一个定义, 说明如何存储并访问特定类型的元数据对象,。类型表示一个特征或一个特性集合, 这些属性定义了元数据对象。具有开发背景的用户将识别类型的相似性, 以面向对象编程语言的 “Class” 定义或关系的 “table schema”数据库。Entity:Atlas 中的一个 “实体” 是类 “type” 的特定

24、值或实例, 因此表示特定的现实世界中的元数据对象。回指我们的面向对象的类比编程语言, “instance” 是某个 “Class” 的 “Object”。Attribute:属性定义在复合 metatypes 中, 如Class和Struct。可以简单将属性称为具有名称和 metatype 值。然而Atlas 中的属性有更多的属性来定义与type system相关的更多概念。上面的定义难以理解。笔者心理也比较抗拒。所以,先看几个例子。例子(1)使用Type定义一个Hive table,而且有一些Attribute:Name: hive_tableMetaType: ClassSuperType

25、s: DataSetAttributes: name: String (name of the table) db: Database object of type hive_db owner: String createTime: Date lastAccessTime: Date comment: String retention: int sd: Storage Description object of type hive_storagedesc partitionKeys: Array of objects of type hive_column aliases: Array of

26、strings columns: Array of objects of type hive_column parameters: Map of String keys to String values viewOriginalText: String viewExpandedText: String tableType: String temporary: Boolean1234567891011121314151617181920这跟java类的定义很相似,也跟json数据定义类似。需要注意的几点:Atlas 中的类型由 “name” 唯一标识每个type 具有 一个metatype。me

27、tatype 表示该模型在 Atlas 中的类型。Atlas 有以下 metatypes:基本 metatypes: 如 Int、字符串、布尔值等。枚举 metatypes: TODO集合 metatypes: 例如阵列、地图复合 metatypes: 如类、结构、特性4.类型可以从名为 “supertype” 的父类型 “extend” 。凭借这一点, 它将得到还包括在超类型中定义的属性。这使模型设计家以在一组相关类型中定义公共属性等。这再次类似于面向对象语言如何定类的超级类的概念。在本示例中, 每个配置单元表都从预定义的超类型称为”DataSet”。有关此预定义的更多详细信息类型将在以后提

28、供。在 Atlas 中的类型也可以从多个超级类型扩展。5.具有 “Class”、”Struct” 或 “Trait” metatype 的类型可以有一个集合属性。每个属性都有一个名称 (例如 “name”) 和其他一些关联的性能。属性可以引用为使用表达式。从上面的说明看,atlas type似乎具有和java中class类似的性质,比如继承。如果我们按照java中对象关系的角度理解,会更容易理解一些。例子(2)一个Entity的定义:id: 9ba387ddfa76429cb791ffc338d3c91ftypeName: “hive_table”values: name: “customer

29、s” db: b42c6cfcc1e742fda9e6890e0adf33bc owner: “admin” createTime: 20160620T06: 13:28.000Z lastAccessTime: 20160620T06: 13:28.000Z comment: null retention: 0 sd: ff58025f685441959f753a3058dd8dcf partitionKeys: null aliases: null columns: 65e2204f6a234130934a9679af6a211f, d726de70faca46fb9c99cf04f6b5

30、79a6, . parameters: transient_lastDdlTime: 1466403208 viewOriginalText: null viewExpandedText: null tableType: “MANAGED_TABLE” temporary: false1234567891011121314151617181920212223上面的id就是Entity的id。顺着java 对象的思路,Entity结构也是比较容易理解的。例子(3)常用api:(1)获取所有的typesGET http:/atlasserverhost:port/api/atlas/typesGET http:/atlasserverhost:port/api/atlas/types?type=STRUCT|CLASS|TRAITResponseresults: Asset, hive_column, Process, storm_node, storm_bolt, falc

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1