構建和安裝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,才能在此環境中運行:
- 配置atlas.graph.storage.hostname(請參見[配置](http://atlas.apache.org/1.0.0/Configuration.html)部分中的“圖形持久性引擎-HBase”)
- 配置atlas.graph.index.search.solr.zookeeper-url(請參見[配置](http://atlas.apache.org/1.0.0/Configuration.html)部分中的“圖形搜索索引-Solr”)。
- 將HBASE_CONF_DIR設置為指向有效的Apache HBase配置目錄(請參見[配置](http://atlas.apache.org/1.0.0/Configuration.html)部分中的“圖形持久性引擎-HBase”)。
- Create indices in Apache Solr (see "Graph Search Index - Solr" in the Configuration section).
使用嵌入式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 UI界面: http://localhost:21000
停止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表,然后再次運行安裝程序。