元数据与数据治理|apache-atlas-0.8.4 源码编译和安装部署(apache版本)

1.文档地址:
    官网地址: https://atlas.apache.org/
 
 
2.源码编译
2.1 把apache-atlas-0.8.4-sources.tar.gz上传到hadoop102的/opt/software目录下
2.2 解压apache-atlas-0.8.4-sources.tar.gz到/opt/module/目录下面
    [luomk@hadoop102 software]$ tar -zxvf apache-atlas-0.8.4-sources.tar.gz -C /opt/module/
2.3 下载Atlas依赖
[luomk@hadoop102 module]$ export MAVEN_OPTS="-Xms2g -Xmx2g"
[luomk@hadoop102 module]$ cd /opt/module/apache-atlas-sources-0.8.4/
[luomk@hadoop102 apache-atlas-sources-0.8.4]$ mvn clean -DskipTests install
    提示:执行过程比较长,会下载很多依赖,大约需要半个小时,期间如果报错很有可能是因为TimeOut造成的网络中断,重试即可。 若编译成功,则会提示下面的内容

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Apache Atlas Server Build Tools 1.0 ................ SUCCESS [01:27 min]
[INFO] apache-atlas 0.8.4 ................................. SUCCESS [03:43 min]
[INFO] Apache Atlas Integration 0.8.4 ..................... SUCCESS [ 58.111 s]
[INFO] Apache Atlas Common 0.8.4 .......................... SUCCESS [  7.020 s]
[INFO] Apache Atlas Typesystem 0.8.4 ...................... SUCCESS [01:33 min]
[INFO] Apache Atlas Client 0.8.4 .......................... SUCCESS [  2.011 s]
[INFO] atlas-client-common 0.8.4 .......................... SUCCESS [  5.119 s]
[INFO] atlas-client-v1 0.8.4 .............................. SUCCESS [  4.265 s]
[INFO] Apache Atlas Server API 0.8.4 ...................... SUCCESS [  3.208 s]
[INFO] Apache Atlas Notification 0.8.4 .................... SUCCESS [ 27.189 s]
[INFO] atlas-client-v2 0.8.4 .............................. SUCCESS [  3.447 s]
[INFO] Apache Atlas Graph Database Projects 0.8.4 ......... SUCCESS [  0.283 s]
[INFO] Apache Atlas Graph Database API 0.8.4 .............. SUCCESS [  2.580 s]
[INFO] Graph Database Common Code 0.8.4 ................... SUCCESS [  3.774 s]
[INFO] Apache Atlas Titan 1.0.0 GraphDB Impl 0.8.4 ........ SUCCESS [02:19 min]
[INFO] Shaded version of Apache hbase client 0.8.4 ........ SUCCESS [ 10.828 s]
[INFO] Apache Atlas Titan 0.5.4 Graph DB Impl 0.8.4 ....... SUCCESS [ 51.402 s]
[INFO] Apache Atlas Graph Database Implementation Dependencies 0.8.4 SUCCESS [  2.409 s]
[INFO] Shaded version of Apache hbase server 0.8.4 ........ SUCCESS [ 31.778 s]
[INFO] Apache Atlas Repository 0.8.4 ...................... SUCCESS [ 48.608 s]
[INFO] Apache Atlas Authorization 0.8.4 ................... SUCCESS [  3.550 s]
[INFO] Apache Atlas Business Catalog 0.8.4 ................ SUCCESS [  9.705 s]
[INFO] Apache Atlas UI 0.8.4 .............................. SUCCESS [02:47 min]
[INFO] Apache Atlas Web Application 0.8.4 ................. SUCCESS [04:33 min]
[INFO] Apache Atlas Documentation 0.8.4 ................... SUCCESS [01:47 min]
[INFO] Apache Atlas FileSystem Model 0.8.4 ................ SUCCESS [  3.548 s]
[INFO] Apache Atlas Plugin Classloader 0.8.4 .............. SUCCESS [  3.193 s]
[INFO] Apache Atlas Hive Bridge Shim 0.8.4 ................ SUCCESS [01:37 min]
[INFO] Apache Atlas Hive Bridge 0.8.4 ..................... SUCCESS [ 18.784 s]
[INFO] Apache Atlas Falcon Bridge Shim 0.8.4 .............. SUCCESS [ 39.190 s]
[INFO] Apache Atlas Falcon Bridge 0.8.4 ................... SUCCESS [  4.304 s]
[INFO] Apache Atlas Sqoop Bridge Shim 0.8.4 ............... SUCCESS [03:08 min]
[INFO] Apache Atlas Sqoop Bridge 0.8.4 .................... SUCCESS [  4.165 s]
[INFO] Apache Atlas Storm Bridge Shim 0.8.4 ............... SUCCESS [ 20.915 s]
[INFO] Apache Atlas Storm Bridge 0.8.4 .................... SUCCESS [  7.858 s]
[INFO] Apache Atlas Hbase Bridge Shim 0.8.4 ............... SUCCESS [  5.518 s]
[INFO] Apache Atlas Hbase Bridge 0.8.4 .................... SUCCESS [ 30.302 s]
[INFO] Apache Atlas Migration Exporter 0.8.4 .............. SUCCESS [  4.952 s]
[INFO] Apache Atlas Distribution 0.8.4 .................... SUCCESS [  2.183 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  31:16 min
[INFO] Finished at: 2019-10-16T15:51:13+08:00
[INFO] ------------------------------------------------------------------------
[root@pdcbdptmp01p apache-atlas-sources-0.8.4]#
 
2.4 打包2.4.1 有多种选择,这种方法是比较简单的内嵌方式打包
mvn clean -DskipTests package -Pdist,embedded-hbase-solr
 
2.4.2 也可以使用以下几种方式进行打包(使用外部的hbase和solr,我们所使用的)
mvn clean -DskipTests package -Pdist

   打包结束后,可以到atlas源代码目录的 distro/target目录下拿到打包出来的产 apache-atlas-0.8.4-bin.tar.gz 进行安装即可。

 
 
3.安装前环境准备
    Atlas安装分为:集成自带的HBase+Solr;集成外部的HBase+Solr。通常企业开发中选择集成外部的HBase+Solr,方便项目整体进行集成操作。
服务名称
子服务
服务器hadoop102
服务器 hadoop103
服务器 hadoop104
HDFS
NameNode
 
 
DataNode
SecondaryNameNode
 
 
Yarn
NodeManager
Resourcemanager
 
 
Zookeeper
QuorumPeerMain
Kafka
Kafka
HBase
HMaster
 
 
HRegionServer
Solr
Jar
Hive
Hive
 
 
MySQL
MySQL
 
 
Azkaban
AzkabanWebServer
 
 
AzkabanExecutorServer
 
 
Atlas
atlas
 
 
服务数总计
 
13
7
7
 
 
3.1 安装JDK8、Hadoop2.7.2
    之前已安装,详见相关文章。
3.2 安装Zookeeper3.4.10
    之前已安装,详见相关文章。
3.3 安装Kafka0.11.0.2
    之前已安装,详见相关文章。
3.4 安装Hbase1.3.1
    之前已安装,详见相关文章。
3.5 安装Solr5.2.1
3.5.1 Solr版本要求必须是5.2.1,见官网。
3.5.3 把solr-5.2.1.tgz上传到hadoop102的/opt/software目录下
3.5.4 解压solr-5.2.1.tgz到/opt/module/目录下面
    [luomk@hadoop102 software]$ tar -zxvf solr-5.2.1.tgz -C /opt/module/
3.5.5 修改solr-5.2.1的名称为solr
    [luomk@hadoop102 module]$ mv solr-5.2.1/ solr
3.5.6 进入solr/bin目录,修改solr.in.sh文件
[luomk@hadoop102 solr]$ vim bin/solr.in.sh
#添加下列指令
ZK_HOST="hadoop102:2181,hadoop103:2181,hadoop104:2181"
SOLR_HOST="hadoop102"
# Sets the port Solr binds to, default is 8983
#可修改端口号
SOLR_PORT=8983

3.5.7 分发Solr,进行Cloud模式部署

    [luomk@hadoop102 module]$ xsync solr
    提示:分发完成后,分别对hadoop103、hadoop104主机/opt/module/solr/bin下的solr.in.sh文件,修改为SOLR_HOST=对应主机名。
3.5.8 在三台节点上分别启动Solr,这个就是Cloud模式
[luomk@hadoop102 solr]$ bin/solr start
[luomk@hadoop103 solr]$ bin/solr start
[luomk@hadoop104 solr]$ bin/solr start

    提示:启动Solr前,需要提前启动Zookeeper服务。

3.5.9 Web访问8983端口,可指定三台节点中的任意一台IP, http://hadoop102:8983/solr/#/
    提示:UI界面出现Cloud菜单栏时,Solr的Cloud模式才算部署成功。
3.5.10 编写Solr启动停止脚本(1)在hadoop102的/home/luomk/bin目录下创建脚本

[luomk@hadoop102 bin]$ vim s.sh
在脚本中编写如下内容


#!/bin/bash
case $1 in
"start"){
    for i in hadoop102 hadoop103 hadoop104
    do
        ssh $i "/opt/module/solr/bin/solr start"
    done
};;
"stop"){
    for i in hadoop102 hadoop103 hadoop104
    do
        ssh $i "/opt/module/solr/bin/solr stop"
    done
};;
esac
(2)增加脚本执行权限
    [luomk@hadoop102 bin]$ chmod 777 s.sh
(3)Solr集群启动脚本
    [luomk@hadoop102 module]$ s.sh start
(4)Solr集群停止脚本
    [luomk@hadoop102 module]$ s.sh stop

3.6 安装Hive1.2.1

    之前已安装,详见相关文章。
3.7 安装Azkaban2.5.0
    之前已安装,详见相关文章。
3.8 安装Atlas0.8.4
3.8.1 把apache-atlas-0.8.4-bin.tar.gz上传到hadoop102的/opt/software目录下
3.8.2 解压apache-atlas-0.8.4-bin.tar.gz到/opt/module/目录下面
    [luomk@hadoop102 software]$ tar -zxvf apache-atlas-0.8.4-bin.tar.gz -C /opt/module/
3.8.3 修改apache-atlas-0.8.4的名称为atlas
    [luomk@hadoop102 module]$ mv apache-atlas-0.8.4/ atlas
 
 
4.Atlas集成外部框架
4.1 Atlas集成Hbase
4.1.1 进入/opt/module/atlas/conf/目录,修改配置文件
[luomk@hadoop102 conf]$ vim atlas-application.properties


#修改atlas存储数据主机
atlas.graph.storage.hostname=hadoop102:2181,hadoop103:2181,hadoop104:2181

4.1.2 进入到/opt/module/atlas/conf/hbase路径,添加Hbase集群的配置文件到${Atlas_Home}

[luomk@hadoop102 hbase]$
ln -s /opt/module/hbase/conf/ /opt/module/atlas/conf/hbase/

4.1.3 在/opt/module/atlas/conf/atlas-env.sh中添加HBASE_CONF_DIR

[luomk@hadoop102 conf]$ vim atlas-env.sh


#添加HBase配置文件路径
export HBASE_CONF_DIR=/opt/module/atlas/conf/hbase/conf

 

 
4.2 Atlas集成Solr4.2.1 进入/opt/module/atlas/conf目录,修改配置文件

[luomk@hadoop102 conf]$ vim atlas-application.properties


#修改如下配置
atlas.graph.index.search.solr.zookeeper-url=hadoop102:2181,hadoop103:2181,hadoop104:2181
 
4.2.2 将Atlas自带的Solr文件夹拷贝到外部Solr集群的各个节点。
[luomk@hadoop102 conf]$
cp -r /opt/module/atlas/conf/solr /opt/module/solr/

4.2.3 进入到/opt/module/solr路径,修改拷贝过来的配置文件名称为atlas_con

[luomk@hadoop102 solr]$ mv solr atlas_conf

4.2.4 在Cloud模式下,启动Solr(需要提前启动Zookeeper集群),并创建collection


[luomk@hadoop102 solr]$ bin/solr create -c vertex_index -d /opt/module/solr/atlas_conf -shards 3 -replicationFactor 2
[luomk@hadoop102 solr]$ bin/solr create -c edge_index -d /opt/module/solr/atlas_conf -shards 3 -replicationFactor 2
[luomk@hadoop102 solr]$ bin/solr create -c fulltext_index -d /opt/module/solr/atlas_conf -shards 3 -replicationFactor 2

    -shards 3:表示该集合分片数为3

    -replicationFactor 2:表示每个分片数都有2个备份
    vertex_index、edge_index、fulltext_index:表示集合名称
    注意:如果需要删除vertex_index、edge_index、fulltext_index等collection可以执行如下命令。
    [luomk@hadoop102 solr]$ bin/solr delete -c ${collection_name}
4.2.5 验证创建collection成功
    登录solr web控制台: http://hadoop102:8983/solr/#/~cloud 看到如下图显示:
 
 
4.3 Atlas集成Kafka4.3.1 进入/opt/module/atlas/conf/目录,修改配置文件atlas-application.properties

[luomk@hadoop102 conf]$ vim atlas-application.properties




#########  Notification Configs  #########
atlas.notification.embedded=false
atlas.kafka.zookeeper.connect=hadoop102:2181,hadoop103:2181,hadoop104:2181
atlas.kafka.bootstrap.servers=hadoop102:9092,hadoop103:9092,hadoop104:9092
atlas.kafka.zookeeper.session.timeout.ms=4000
atlas.kafka.zookeeper.connection.timeout.ms=2000




atlas.kafka.enable.auto.commit=true
 
4.3.2 启动Kafka集群,并创建Topic
[luomk@hadoop102 kafka]$ bin/kafka-topics.sh --zookeeper hadoop102:2181,hadoop103:2181,hadoop104:2181 --create --replication-factor 3 --partitions 3 --topic _HOATLASOK




[luomk@hadoop102 kafka]$ bin/kafka-topics.sh --zookeeper hadoop102:2181,hadoop103:2181,hadoop104:2181 --create --replication-factor 3 --partitions 3 --topic ATLAS_ENTITIES

 

 
4.4 Atlas其他配置4.4.1 进入/opt/module/atlas/conf/目录,修改配置文件atlas-application.properties

[luomk@hadoop102 conf]$ vim atlas-application.properties




#########  Server Properties  #########
atlas.rest.address=http://hadoop102:21000
# If enabled and set to true, this will run setup steps when the server starts
atlas.server.run.setup.on.start=false




#########  Entity Audit Configs  #########
atlas.audit.hbase.zookeeper.quorum=hadoop102:2181,hadoop103:2181,hadoop104:2181
 
4.4.2 记录性能指标,进入/opt/module/atlas/conf/路径,修改当前目录下的atlas-log4j.xml

[luomk@hadoop102 conf]$ vim atlas-log4j.xml




#去掉如下代码的注释
<appender name="perf_appender" class="org.apache.log4j.DailyRollingFileAppender">
    <param name="file" value="${atlas.log.dir}/atlas_perf.log" />
    <param name="datePattern" value="'.'yyyy-MM-dd" />
    <param name="append" value="true" />
    <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="%d|%t|%m%n" />
    </layout>
</appender>




<logger name="org.apache.atlas.perf" additivity="false">
    <level value="debug" />
    <appender-ref ref="perf_appender" />
</logger>

 

 
4.5 Atlas集成Hive4.5.1 进入/opt/module/atlas/conf/目录,修改配置文件atlas-application.properties

[luomk@hadoop102 conf]$ vim atlas-application.properties




######### Hive Hook Configs #######
atlas.hook.hive.synchronous=false
atlas.hook.hive.numRetries=3
atlas.hook.hive.queueSize=10000
atlas.cluster.name=primary
 
4.5.2 将atlas-application.properties配置文件加入到atlas-plugin-classloader-1.0.0.jar中

[luomk@hadoop102 hive]$ zip -u /opt/module/atlas/hook/hive/atlas-plugin-classloader-0.8.4.jar /opt/module/atlas/conf/atlas-application.properties
[luomk@hadoop102 hive]$ cp /opt/module/atlas/conf/atlas-application.properties /opt/module/hive/conf/
 
    原因:这个配置不能参照官网,将配置文件考到hive的conf中。参考官网的做法一直读取不到atlas-application.properties配置文件,看了源码发现是在classpath读取的这个配置文件,所以将它压到jar里面。
4.5.3 在/opt/module/hive/conf/hive-site.xml文件中设置Atlas hook
[luomk@hadoop102 conf]$ vim hive-site.xml
<property>
      <name>hive.exec.post.hooks</name>
      <value>org.apache.atlas.hive.hook.HiveHook</value>
</property>




[luomk@hadoop102 conf]$ vim hive-env.sh


#在tez引擎依赖的jar包后面追加hive插件相关jar包
export HIVE_AUX_JARS_PATH=/opt/module/hadoop-2.7.2/share/hadoop/common/hadoop-lzo-0.4.20.jar$TEZ_JARS,/opt/module/atlas/hook/hive/atlas-plugin-classloader-0.8.4.jar,/opt/module/atlas/hook/hive/hive-bridge-shim-0.8.4.jar

 

5.集群启动
5.1 启动Hadoop集群
    [luomk@hadoop102 hadoop-2.7.2]$ sbin/start-dfs.sh
    [luomk@hadoop103 hadoop-2.7.2]$ sbin/start-yarn.sh
5.2 启动Zookeeper集群
    [luomk@hadoop102 zookeeper-3.4.10]$ zk.sh start
5.3. 启动Kafka集群
    [luomk@hadoop102 kafka]$ kf.sh start
5.4 启动Hbase集群:
    [luomk@hadoop102 hbase]$ bin/start-hbase.sh
5.5 启动Solr集群
    [luomk@hadoop102 solr]$ bin/solr start
    [luomk@hadoop103 solr]$ bin/solr start
    [luomk@hadoop104 solr]$ bin/solr start
5.6 进入/opt/module/atlas路径,重新启动Atlas服务
    [luomk@hadoop102 atlas]$ bin/atlas_stop.py
    [luomk@hadoop102 atlas]$ bin/atlas_start.py
提示:错误信息查看路径:/opt/module/atlas/logs/*.out和application.log
访问地址: http://hadoop102:21000
注意:等待时间大概2分钟。
账户:admin
密码:admin
 
 
6.将Hive元数据导入Atlas6.1 配置Hive环境变量

[luomk@hadoop102 hive]$ sudo vim /etc/profile


#配置Hive环境变量
export HIVE_HOME=/opt/module/hive
export PATH=$PATH:$HIVE_HOME/bin/


[luomk@hadoop102 hive]$ source /etc/profile
 
6.2 启动Hive,如果Hive能正常启动说明环境OK,就可以退出Hive客户端

[luomk@hadoop102 hive]$ hive
hive (default)> show databases;
hive (default)> use gmall;
 
6.3 在/opt/module/atlas/路径,将Hive元数据导入到Atlas
[luomk@hadoop102 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!!!

 

7.Atlas常用配置(可选)
7.1 配置内存
    如果计划存储数万个元数据对象,建议调整参数值获得最佳的JVM GC性能。以下是常见的服务器端选项    修改配置文件/opt/module/atlas/conf/atlas-env.sh

#设置Atlas内存
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"




#建议JDK1.7使用以下配置
export ATLAS_SERVER_HEAP="-Xms15360m -Xmx15360m -XX:MaxNewSize=3072m -XX:PermSize=100M -XX:MaxPermSize=512m"




#建议JDK1.8使用以下配置
export ATLAS_SERVER_HEAP="-Xms15360m -Xmx15360m -XX:MaxNewSize=5120m -XX:MetaspaceSize=100M -XX:MaxMetaspaceSize=512m"




#如果是Mac OS用户需要配置
export ATLAS_SERVER_OPTS="-Djava.awt.headless=true -Djava.security.krb5.realm= -Djava.security.krb5.kdc="


# 参数说明: -XX:SoftRefLRUPolicyMSPerMB 此参数对管理具有许多并发用户的查询繁重工作负载的GC性能特别有用。

 

 
7.2 配置用户名密码
    Atlas支持以下身份验证方法:File、Kerberos协议、LDAP协议
    通过修改配置文件atlas-application.properties文件开启或关闭三种验证方法
atlas.authentication.method.kerberos=true|false
atlas.authentication.method.ldap=true|false
atlas.authentication.method.file=true|false
    如果两个或多个身份证验证方法设置为true,如果较早的方法失败,则身份验证将回退到后一种方法。例如,如果Kerberos身份验证设置为true并且ldap身份验证也设置为true,那么,如果对于没有kerberos principal和keytab的请求,LDAP身份验证将作为后备方案。

    本文主要讲解采用文件方式修改用户名和密码设置。其他方式可以参见官网配置即可。

7.2.1 打开/opt/module/atlas/conf/users-credentials.properties文件


[luomk@hadoop102 conf]$ vim users-credentials.properties


#username=group::sha256-password
admin=ADMIN::8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918
rangertagsync=RANGER_TAG_SYNC::e3f67240f5117d1753c940dae9eea772d36ed5fe9bd9c94a300e40413f1afb9d
 
(1)admin是用户名称
(2)8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918是采用sha256加密的密码,默认密码为admin。
7.2.2 例如:修改用户名称为luomk,密码为luomk
(1)获取sha256加密的luomk密码
[luomk@hadoop102 conf]$ echo -n "luomk"|sha256sum
2628be627712c3555d65e0e5f9101dbdd403626e6646b72fdf728a20c5261dc2
(2)修改用户名和密码

[luomk@hadoop102 conf]$ vim users-credentials.properties


#username=group::sha256-password
luomk=ADMIN::2628be627712c3555d65e0e5f9101dbdd403626e6646b72fdf728a20c5261dc2
rangertagsync=RANGER_TAG_SYNC::e3f67240f5117d1753c940dae9eea772d36ed5fe9bd9c94a300e40413f1afb9d
 
 
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序员学习圈

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值