目录
Atlas 官网地址:https://atlas.apache.org/
文档查看地址:https://atlas.apache.org/2.1.0/index.html
下载地址:https://www.apache.org/dyn/closer.cgi/atlas/2.1.0/apache-atlas-2.1.0-sources.tar.gz
一、安装环境准备
Atlas 安装分为:集成自带的 HBase + Solr 及 集成外部的 HBase + Solr。通常企业开发中选择集成外部的 HBase + Solr,方便项目整体进行集成操作。
以下是 Atlas 所以依赖的环境及集群规划。本文只包含 Solr 和 Atlas 的安装指南,其余所依赖服务的安装请参考前边章节。
服务名称 | 子服务 | 服务器hadoop102 | 服务器hadoop103 | 服务器hadoop104 |
---|---|---|---|---|
JDK | √ | √ | √ | |
Zookeeper | QuorumPeerMain | √ | √ | √ |
Kafka | Kafka | √ | √ | √ |
HBase | HMaster | √ | ||
HRegionServer | √ | √ | √ | |
Solr | Jar | √ | √ | √ |
Hive | Hive | √ | ||
Atlas | atlas | √ | ||
服务数总计 | 13 | 7 | 7 |
1. 安装 Solr-7.7.3
A、在每台节点创建系统用户 solr
[root@hadoop102 ~]# useradd solr
[root@hadoop102 ~]# echo solr | passwd --stdin solr
[root@hadoop103 ~]# useradd solr
[root@hadoop103 ~]# echo solr | passwd --stdin solr
[root@hadoop104 ~]# useradd solr
[root@hadoop104 ~]# echo solr | passwd --stdin solr
B、解压 solr-7.7.3.tgz 到 /opt/module 目录,并改名为 solr
[root@hadoop102 ~]# tar -zxvf solr-7.7.3.tgz -C /opt/module/
[root@hadoop102 ~]# mv solr-7.7.3/ solr
C、修改 solr 目录的所有者为 solr 用户
[root@hadoop102 ~]# chown -R solr:solr /opt/module/solr
D、修改 solr 配置文件
修改 /opt/module/solr/bin/solr.in.sh 文件中的以下属性
ZK_HOST="hadoop102:2181,hadoop103:2181,hadoop104:2181"
E、分发solr
[root@hadoop102 ~]# xsync /opt/module/solr
F、启动 solr 集群
启动 Zookeeper 集群 :
[root@hadoop102 ~]# zk.sh start
启动 solr 集群 :
出于安全考虑,不推荐使用 root 用户启动 solr,此处使用 solr 用户,在所有节点执行以下命令启动 solr 集群。
[root@hadoop102 ~]# sudo -i -u solr /opt/module/solr/bin/solr start
[root@hadoop103 ~]# sudo -i -u solr /opt/module/solr/bin/solr start
[root@hadoop104 ~]# sudo -i -u solr /opt/module/solr/bin/solr start
出现 Happy Searching! 字样表明启动成功。
说明:
上述警告内容是:solr 推荐系统允许的最大进程数和最大打开文件数分别为 65000 和 65000,而系统默认值低于推荐值。如需修改可参考以下步骤,修改完需要重启方可生效,此处可暂不修改。
修改打开文件数限制 :
修改/etc/security/limits.conf文件,增加以下内容
* soft nofile 65000
* hard nofile 65000
修改进程数限制
修改/etc/security/limits.d/20-nproc.conf文件
* soft nproc 65000
重启服务器
G、访问 web 页面
默认端口为 8983,可指定三台节点中的任意一台 IP,http://hadoop102:8983
提示:UI 界面出现 Cloud 菜单栏时,Solr 的 Cloud 模式才算部署成功。
2. 安装 Atlas2.1.0
A、把 apache-atlas-2.1.0-server.tar.gz 上传到 hadoop102 的 /opt/software 目录下
B、解压 apache-atlas-2.1.0-server.tar.gz 到 /opt/module/ 目录下面
[root@hadoop102 software]# tar -zxvf apache-atlas-2.1.0-server.tar.gz -C /opt/module/
C、修改 apache-atlas-2.1.0 的名称为 atlas
[root@hadoop102 ~]# mv /opt/module/apache-atlas-2.1.0 /opt/module/atlas
二、Atlas 配置
1. Atlas 集成 Hbase
修改 /opt/module/atlas/conf/atlas-application.properties 配置文件中的以下参数
atlas.graph.storage.hostname=hadoop102:2181,hadoop103:2181,hadoop104:2181
修改 /opt/module/atlas/conf/atlas-env.sh 配置文件,增加以下内容
export HBASE_CONF_DIR=/opt/module/hbase/conf
2. Atlas 集成 Solr
修改 /opt/module/atlas/conf/atlas-application.properties 配置文件中的以下参数
atlas.graph.index.search.backend=solr
atlas.graph.index.search.solr.mode=cloud
atlas.graph.index.search.solr.zookeeper-url=hadoop102:2181,hadoop103:2181,hadoop104:2181
创建 solr collection
[root@hadoop102 ~]# sudo -i -u solr /opt/module/solr/bin/solr create -c vertex_index -d /opt/module/atlas/conf/solr -shards 3 -replicationFactor 2
[root@hadoop102 ~]# sudo -i -u solr /opt/module/solr/bin/solr create -c edge_index -d /opt/module/atlas/conf/solr -shards 3 -replicationFactor 2
[root@hadoop102 ~]# sudo -i -u solr /opt/module/solr/bin/solr create -c fulltext_index -d /opt/module/atlas/conf/solr -shards 3 -replicationFactor 2
3. Atlas 集成 Kafka
修改 /opt/module/atlas/conf/atlas-application.properties 配置文件中的以下参数
atlas.notification.embedded=false
atlas.kafka.data=/opt/module/kafka/data
atlas.kafka.zookeeper.connect= hadoop102:2181,hadoop103:2181,hadoop104:2181/kafka
atlas.kafka.bootstrap.servers=hadoop102:9092,hadoop103:9092,hadoop104:9092
4. Atlas Server 配置
修改 /opt/module/atlas/conf/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
记录性能指标,进入 /opt/module/atlas/conf/
路径,修改当前目录下的 atlas-log4j.xml
[root@hadoop101 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>
5. Kerberos 相关配置
若 Hadoop 集群开启了 Kerberos 认证,Atlas 与 Hadoop 集群交互之前就需要先进行 Kerberos 认证。若 Hadoop 集群未开启 Kerberos 认证,则本节可跳过。
为 Atlas 创建 Kerberos 主体,并生成 keytab 文件
[root@hadoop102 ~]# kadmin -padmin/admin -wadmin -q"addprinc -randkey atlas/hadoop102"
[root@hadoop102 ~]# kadmin -padmin/admin -wadmin -q"xst -k /etc/security/keytab/atlas.service.keytab atlas/hadoop102"
修改 /opt/module/atlas/conf/atlas-application.properties 配置文件,增加以下参数
atlas.authentication.method=kerberos
atlas.authentication.principal=atlas/hadoop102@EXAMPLE.COM
atlas.authentication.keytab=/etc/security/keytab/atlas.service.keytab
6. Atlas 集成 Hive
A、安装 Hive Hook
解压 Hive Hook
[root@hadoop102 ~]# tar -zxvf apache-atlas-2.1.0-hive-hook.tar.gz
将 Hive Hook 依赖复制到 Atlas 安装路径
[root@hadoop102 ~]# cp -r apache-atlas-hive-hook-2.1.0/* /opt/module/atlas/
修改 /opt/module/hive/conf/hive-env.sh 配置文件
注:需先需改文件名
[root@hadoop102 ~]# mv hive-env.sh.template hive-env.sh
增加如下参数
export HIVE_AUX_JARS_PATH=/opt/module/atlas/hook/hive
B、修改 Hive 配置文件
在 /opt/module/hive/conf/hive-site.xml 文件中增加以下参数,配置 Hive Hook。
<property>
<name>hive.exec.post.hooks</name>
<value>org.apache.atlas.hive.hook.HiveHook</value>
</property>
C、修改 /opt/module/atlas/conf/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
D、将 Atlas 配置文件 /opt/module/atlas/conf/atlas-application.properties 拷贝到 /opt/module/hive/conf 目录
[root@hadoop102 ~]# cp /opt/module/atlas/conf/atlas-application.properties /opt/module/hive/conf/
三、Atlas 启动
启动 Atlas 所依赖的环境
A、启动 Hadoop 集群
在 NameNode 节点执行以下命令,启动 HDFS
[root@hadoop102 ~]# start-dfs.sh
在 ResourceManager 节点执行以下命令,启动 Yarn
[root@hadoop103 ~]# start-yarn.sh
B、启动 Zookeeper 集群
[root@hadoop102 ~]# zk.sh start
C、启动 Kafka 集群
[root@hadoop102 ~]# kf.sh start
D、启动 Hbase 集群
在 HMaster 节点执行以下命令,使用 hbase 用户启动 HBase
[root@hadoop102 ~]# sudo -i -u hbase start-hbase.sh
E、启动 Solr 集群
在所有节点执行以下命令,使用 solr 用户启动 Solr
[root@hadoop102 ~]# sudo -i -u solr /opt/module/solr/bin/solr start
[root@hadoop103 ~]# sudo -i -u solr /opt/module/solr/bin/solr start
[root@hadoop104 ~]# sudo -i -u solr /opt/module/solr/bin/solr start
F、进入 /opt/module/atlas 路径,启动 Atlas 服务
[root@hadoop102 atlas]# bin/atlas_start.py
提示:
- 错误信息查看路径:
/opt/module/atlas/logs/*.out
和application.log
- 停止 Atlas 服务命令为 atlas_stop.py
G、访问 Atlas 的 WebUI
访问地址:http://hadoop102:21000
注意:等待若干分钟。
账户:admin