构建和安装Apache Atlas1.0.0

Apache Atlas

构建和安装Apache Atlas

构建Apache Atlas

下载 Apache Atlas 1.0.0 发行版源码, apache-atlas-1.0.0-sources.tar.gz, 从 downloads 下载. 然后按照以下说明构建Apache Atlas。

tar xvfz apache-atlas-1.0.0-sources.tar.gz
cd apache-atlas-sources-1.0.0/
export MAVEN_OPTS="-Xms2g -Xmx2g"
mvn clean -DskipTests installxxxxxxxxxx tar xvfz apache-atlas-1.0.0-sources.tar.gzcd apache-atlas-sources-1.0.0/export MAVEN_OPTS="-Xms2g -Xmx2g"mvn clean -DskipTests installtar xvfz apache-atlas-1.0.0-sources.tar.gzbash

打包Apache Atlas

要创建Apache Atlas软件包以在具有功能的Apache HBase和Apache Solr实例的环境中进行部署,请使用以下命令进行构建:

mvn clean -DskipTests package -Pdist
  • 注意:
    • 删除选项“ -DskipTests”以运行单元和集成测试
    • 要构建没有缩小的js,css文件的发行版,请使用* skipMinify *配置文件进行构建。
      默认情况下,最小化js和css文件。

上面将为具有功能性HBase和Solr实例的环境构建Apache Atlas。需要在以下环境中设置Apache Atlas,才能在此环境中运行:

使用嵌入式Apache HBase和Apache Solr打包Apache Atlas

要创建包含Apache HBase和Apache Solr的Apache Atlas软件包,请使用Embedded-hbase-solr配置文件进行构建,如下所示:

mvn clean -DskipTests package -Pdist,embedded-hbase-solr

使用Embedded-hbase-solr配置文件将配置Apache Atlas,以便与Apache Atlas服务器一起启动和停止Apache HBase实例和Apache Solr实例。

注意:此分发配置文件仅旨在用于单节点开发,而不能用于生产环境。

使用Apache Cassandra和Apache Solr打包Apache Atlas

要创建包含Apache Cassandra和Apache Solr的Apache Atlas软件包,请使用Embedded-cassandra-solr配置文件进行构建,如下所示:

mvn clean package -Pdist,embedded-cassandra-solr

使用Embedded-cassandra-solr配置文件将配置Apache Atlas,以便与Atlas服务器一起启动和停止Apache Cassandra实例和Apache Solr实例。

注意:此分发配置文件仅旨在用于单节点开发,而不能用于生产环境。

Atlas 打包

Build将创建以下文件,这些文件用于安装Apache Atlas。

distro/target/apache-atlas-${project.version}-bin.tar.gz
distro/target/apache-atlas-${project.version}-hbase-hook.tar.gz
distro/target/apache-atlas-${project.version}-hive-hook.gz
distro/target/apache-atlas-${project.version}-kafka-hook.gz
distro/target/apache-atlas-${project.version}-sources.tar.gz
distro/target/apache-atlas-${project.version}-sqoop-hook.tar.gz
distro/target/apache-atlas-${project.version}-storm-hook.tar.gz

安装 & 运行 Apache Atlas

安装 Apache Atlas

从您要安装Apache Atlas的目录中,运行以下命令:

tar -xzvf apache-atlas-${project.version}-bin.tar.gz
cd atlas-${project.version}
使用本地Apache HBase和Apache Solr运行Apache Atlas

使用本地Apache HBase和Apache Solr运行Apache Atlas

export MANAGE_LOCAL_HBASE=true
export MANAGE_LOCAL_SOLR=true

bin/atlas_start.py
使用Apache Atlas
  • 要验证Apache Atlas服务器是否已启动并正在运行,请运行curl命令,如下所示:
  curl -u username:password http://localhost:21000/api/atlas/admin/version

  {"Description":"Metadata Management and Data Governance Platform over Hadoop","Version":"1.0.0","Name":"apache-atlas"}
  • 快速启动以加载样本模型和数据
  bin/quick_start.py
  Enter username for atlas :-
  Enter password for atlas :-
停止Apache Atlas服务器

要停止Apache Atlas,请运行以下命令:

bin/atlas_stop.py

配置Apache Atlas

默认情况下,Apache Atlas使用的配置目录为* {package dir} / conf *。
要将设置的环境变量ATLAS_CONF覆盖到conf目录的路径。

可以在conf目录的* atlas-env.sh *文件中设置运行Apache Atlas所需的环境变量。
在执行任何命令之前,此文件将由Apache Atlas脚本获取。
可以设置以下环境变量。

# The java implementation to use. If JAVA_HOME is not 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 for 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 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 expand the war file. By Default it is in /server/webapp dir under the base install dir.
#export ATLAS_EXPANDED_WEBAPP_DIR=

支持大量元数据对象的设置

如果计划存储大量的元数据对象,建议您使用调整后的值以提高JVM的GC性能。

以下值是服务器端的常用选项:

export ATLAS_SERVER_OPTS="-server -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+PrintTenuringDistribution -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dumps/atlas_server.hprof -Xloggc:logs/gc-worker.log -verbose:gc -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=1m -XX:+PrintGCDetails -XX:+PrintHeapAtGC -XX:+PrintGCTimeStamps"

The -XX:SoftRefLRUPolicyMSPerMB 发现该选项对于调节具有许多并发用户的繁重工作负载的GC性能特别有用.

对于JDK 8,建议使用以下值:

export ATLAS_SERVER_HEAP="-Xms15360m -Xmx15360m -XX:MaxNewSize=5120m -XX:MetaspaceSize=100M -XX:MaxMetaspaceSize=512m"

**对于Mac OS用户请注意 *如果您使用的是Mac OS,则需要配置ATLAS_SERVER_OPTS(如上所述)。在 {package dir} /conf/atlas-env.sh*中,取消注释以下行

#export ATLAS_SERVER_OPTS=

并将其更改为如下所示

export ATLAS_SERVER_OPTS="-Djava.awt.headless=true -Djava.security.krb5.realm= -Djava.security.krb5.kdc="

将Apache HBase配置为Graph Repository的存储后端

默认情况下,Apache Atlas使用[JanusGraph](http://atlas.apache.org/1.0.0/JanusGraph.html)作为图形存储库,并且是当前唯一可用的图形存储库实现。当前支持的Apache HBase版本是1.1.x。有关在Apache HBase上配置Apache Atlas图持久性的详细信息,请参阅[配置](http://atlas.apache.org/1.0.0/Configuration.html)部分中的“图持久性引擎-HBase”。

可以使用以下配置来设置Apache Atlas使用的Apache HBase表:

atlas.graph.storage.hbase.table=atlas
atlas.audit.hbase.tablename=apache_atlas_entity_audit

将Apache Solr配置为Graph Repository的索引后端

默认情况下,Apache Atlas使用[JanusGraph](http://atlas.apache.org/1.0.0/JanusGraph.html)作为图形存储库,并且是当前唯一可用的图形存储库实现。要配置[JanusGraph](http://atlas.apache.org/1.0.0/JanusGraph.html)以与Apache Solr一起使用,请按照以下说明进行操作

  • 如果尚未运行,请安装Apache Solr。支持的Apache Solr版本是5.5.1。
    可以从http://archive.apache.org/dist/lucene/solr/5.5.1/solr-5.5.1.tgz安装

  • 在云模式下启动Apache Solr。

SolrCloud模式将ZooKeeper服务用作群集管理的高度可用的中央位置。
对于小型集群,可以使用现有的ZooKeeper仲裁运行。
对于较大的群集,您需要运行至少三个服务器的单独的多个ZooKeeper仲裁。
注意:Apache Atlas当前仅在“云”模式下支持Apache Solr。不支持“ http”模式。
有关更多信息,请参阅Apache Solr文档-https://cwiki.apache.org/confluence/display/solr/SolrCloud

  • 例如,要启动在机器上端口8983上侦听的Apache Solr节点,可以使用以下命令:
 $SOLR_HOME/bin/solr start -c -z <zookeeper_host:port> -p 8983
  • 从SOLR_BIN(例如$ SOLR_HOME / bin)目录运行以下命令,以在Apache Solr中创建与Apache Atlas使用的索引相对应的集合。
    如果Apache Atlas和Apache Solr实例位于2个不同的主机上,则首先将所需的配置文件从Apache Atlas实例主机上的ATLAS_HOME / conf / solr复制到Apache Solr实例主机上。
    下文提到的命令中的SOLR_CONF指的是Apache Solr主机上已将Apache Solr配置文件复制到的目录:
  $SOLR_BIN/solr create -c vertex_index -d SOLR_CONF -shards #numShards -replicationFactor #replicationFactor
  $SOLR_BIN/solr create -c edge_index -d SOLR_CONF -shards #numShards -replicationFactor #replicationFactor
  $SOLR_BIN/solr create -c fulltext_index -d SOLR_CONF -shards #numShards -replicationFactor #replicationFactor

注意:如果未指定numShards和ReplicationFactor,则它们的默认值为1,如果您在单个节点实例上尝试使用ATLAS进行solr,就足够了。
否则,请根据Solr集群中的主机数量和maxShardsPerNode配置指定numShards。
分片的数量不能超过!SolrCloud群集中Solr节点的总数。

副本数(replicationFactor)可以根据所需的冗余设置。

还要注意,如果设置了SOLR_BIN和SOLR_CONF环境变量并将搜索索引后端设置为'solr5',则在启动Apache Atlas服务器时将自动调用Apache Solr创建索引。

  • 更改ATLAS配置以指向Apache Solr实例设置。请确保将以下配置设置为
  • ATLAS_HOME / conf / atlas-application.properties中的以下值
 atlas.graph.index.search.backend=solr
 atlas.graph.index.search.solr.mode=cloud
 atlas.graph.index.search.solr.zookeeper-url=<the ZK quorum setup for solr as comma separated value> eg: 10.1.6.4:2181,10.1.6.5:2181
 atlas.graph.index.search.solr.zookeeper-connect-timeout=<SolrCloud Zookeeper Connection Timeout>. Default value is 60000 ms
 atlas.graph.index.search.solr.zookeeper-session-timeout=<SolrCloud Zookeeper Session Timeout>. Default value is 60000 ms

或有关[JanusGraph](http://atlas.apache.org/1.0.0/JanusGraph.html)solr配置的更多信息,请参考http://docs.janusgraph.org/0.2.0/solr.html

在云模式下运行Apache Solr的前提条件内存-Apache Solr占用大量内存和CPU。
确保运行Apache Solr的服务器具有足够的内存,CPU和磁盘。
Apache Solr可以在32GB RAM上很好地工作。
计划为Apache Solr进程提供尽可能多的内存
磁盘-如果需要存储的实体数量很大,请计划在Apache Solr用来存储索引数据的卷中至少有500 GB的可用空间

  • SolrCloud支持复制和分片。
    强烈建议将SolrCloud与至少两个在启用了复制功能的不同服务器上运行的Apache Solr节点一起使用。
    如果使用SolrCloud,则还需要安装ZooKeeper并配置3个或5个ZooKeeper节点

将Elasticsearch配置为图存储库的索引后端(技术预览)

默认情况下,Apache Atlas使用[JanusGraph](http://atlas.apache.org/1.0.0/JanusGraph.html)作为图形存储库,并且是当前唯一可用的图形存储库实现。
要配置[JanusGraph](http://atlas.apache.org/1.0.0/JanusGraph.html)以使用Elasticsearch,请按照以下说明进行操作

  • -安装Elasticsearch集群。
    当前支持的版本是5.6.4,可以从以下网站获取:https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.4.tar.gz

  • 为了进行简单测试,可以使用Elasticsearch发行版的bin目录中的“ elasticsearch”命令启动单个Elasticsearch节点。

  • 更改Apache Atlas配置,以指向Elasticsearch实例设置。
    请确保将以下配置设置为ATLAS_HOME / conf / atlas-application.properties中的以下值

 atlas.graph.index.search.backend=elasticsearch
 atlas.graph.index.search.hostname=<the hostname(s) of the Elasticsearch master nodes comma separated>
 atlas.graph.index.search.elasticsearch.client-only=true

有关用于Elasticsearch的[JanusGraph](http://atlas.apache.org/1.0.0/JanusGraph.html)配置的更多信息,请参阅http://docs.janusgraph.org/0.2.0/elasticsearch.html

配置 Kafka Topics

Apache Atlas使用Apache Kafka在运行时从其他组件获取元数据。
在[体系结构页面](http://atlas.apache.org/1.0.0/Architecture.html)中对此进行了详细描述。
根据Apache Kafka的配置,有时您可能需要在使用Apache Atlas之前显式设置主题。
为此,Apache Atlas提供了一个脚本“ bin / atlas_kafka_setup.py”,可以从Apache Atlas服务器运行该脚本。
在某些环境中,在安装Apache Atlas服务器本身之前,可能首先会开始使用这些挂钩。
在这种情况下,可以使用类似的脚本“ hook-bin / atlas_kafka_setup_hook.py”在安装了挂钩的主机上运行主题。
这两个都使用atlas-application.properties中的配置来设置主题。
有关这些详细信息,请参考[配置页面](http://atlas.apache.org/1.0.0/Configuration.html)。

Setting up Apache Atlas

有一些步骤可以设置Apache Atlas的依赖性。其中一个示例是在所选的存储后端中设置[JanusGraph](http://atlas.apache.org/1.0.0/JanusGraph.html)模式。
在简单的单服务器设置中,当服务器首次访问这些依赖项时,将使用默认配置自动设置它们。

但是,在某些情况下,我们可能希望明确地将设置步骤作为一次性操作运行。
例如,在使用[高可用性](http://atlas.apache.org/1.0.0/HighAvailability.html)的多服务器方案中,最好是第一次从一个服务器实例运行安装步骤,
然后启动服务。

要一次运行这些步骤,请从单个Apache Atlas服务器实例执行命令 bin / atlas_start.py -setup

但是,Apache Atlas服务器确实负责设置步骤的并行执行。
同样,多次运行设置步骤也是幂等的。
因此,如果为了方便起见选择在服务器启动过程中运行设置步骤,则他们应通过在配置选项中将其定义为值true来启用配置选项“ atlas.server.run.setup.on.start”。
atlas-application.properties文件。

示例:调用Apache Atlas REST API

以下是通过curl命令调用Apache Atlas REST API的几个示例。

  • List the types in the repository
  curl -u username:password http://localhost:21000/api/atlas/v2/types/typedefs/headers
  [ {"guid":"fa421be8-c21b-4cf8-a226-fdde559ad598","name":"Referenceable","category":"ENTITY"},
    {"guid":"7f3f5712-521d-450d-9bb2-ba996b6f2a4e","name":"Asset","category":"ENTITY"},
    {"guid":"84b02fa0-e2f4-4cc4-8b24-d2371cd00375","name":"DataSet","category":"ENTITY"},
    {"guid":"f93975d5-5a5c-41da-ad9d-eb7c4f91a093","name":"Process","category":"ENTITY"},
    {"guid":"79dcd1f9-f350-4f7b-b706-5bab416f8206","name":"Infrastructure","category":"ENTITY"}
  ]
  • 列出给定类型的实例
  curl -u username:password http://localhost:21000/api/atlas/v2/search/basic?typeName=hive_db
  {
    "queryType":"BASIC",
    "searchParameters":{
      "typeName":"hive_db",
      "excludeDeletedEntities":false,
      "includeClassificationAttributes":false,
      "includeSubTypes":true,
      "includeSubClassifications":true,
      "limit":100,
      "offset":0
    },
    "entities":[
      {
        "typeName":"hive_db",
        "guid":"5d900c19-094d-4681-8a86-4eb1d6ffbe89",
        "status":"ACTIVE",
        "displayText":"default",
        "classificationNames":[],
        "attributes":{
          "owner":"public",
          "createTime":null,
          "qualifiedName":"default@cl1",
          "name":"default",
          "description":"Default Hive database"
        }
      },
      {
        "typeName":"hive_db",
        "guid":"3a0b14b0-ab85-4b65-89f2-e418f3f7f77c",
        "status":"ACTIVE",
        "displayText":"finance",
        "classificationNames":[],
        "attributes":{
          "owner":"hive",
          "createTime":null,
          "qualifiedName":"finance@cl1",
          "name":"finance",
          "description":null
        }
      }
    ]
  }
  • 搜索实体
  curl -u username:password http://localhost:21000/api/atlas/v2/search/dsl?query=hive_db%20where%20name='default'
    {
      "queryType":"DSL",
      "queryText":"hive_db where name='default'",
      "entities":[
        {
          "typeName":"hive_db",
          "guid":"5d900c19-094d-4681-8a86-4eb1d6ffbe89",
          "status":"ACTIVE",
          "displayText":"default",
          "classificationNames":[],
          "attributes":{
            "owner":"public",
            "createTime":null,
            "qualifiedName":"default@cl1",
            "name":"default",
            "description":
            "Default Hive database"
          }
        }
      ]
    }

排除故障

安装问题

如果Apache Atlas服务的安装由于任何原因失败,则进行下一次安装(通过显式调用atlas_start.py -setup或启用配置选项atlas.server.run.setup.on.start )将失败,并显示一条消息,例如“以前的安装运行可能未完全完成。”。 在这种情况下,您需要手动确保安装程序可以运行并删除/ apache_atlas / setup_in_progress`上的Zookeeper节点,然后再尝试再次运行安装程序。

如果由于Apache HBase模式设置错误而导致安装失败,则可能需要修复Apache HBase模式。
如果尚未存储任何数据,则还可以禁用和删除Apache Atlas使用的Apache HBase表,然后再次运行安装程序。

posted @ 2020-04-26 21:22  邓明晨  阅读(832)  评论(0编辑  收藏  举报