Ambari安装Atlas2.2.0
一、背景
•背景:ambari中部署atlas并升级原始版本(1.1.0)到2.2.0
•技术定位:初级
•目标群体:ambari部署atlas
•技术应用场景:atlas1.1.0与atlas2.2.0的conf差异
•整体思路:比对atlas版本之间的conf目录
二、基础知识
2.1 准备工作
2.1.1 Ambari基础了解
•/etc/atlas/3.1.4.0-315/0 :这个目录是Ambari生成Atlas配置文件的固定目录
•/usr/hdp/3.1.4.0-315:这个目录是Ambari映射安装的的路径
•而在Ambari中只有Atlas1.1.0的配置,没有Atlas2.2.0的配置
•Atlas中的conf目录是通过软连接的方式指向/etc/atlas/3.1.4.0-315/0 ,进而可以获取到在Ambari前端进行配置的信息
2.1.2 获取Atlas各版本的conf目录
Atlas1.1.0的conf目录(这里面的ranger-atlas-audit.xml、ranger-atlas-security.xml、ranger-policymgr-ssl.xml三个文件是启动Atlas,Ambari自动生成的。)
在这里插入图片描述
Atlas2.2.0的conf目录
2.2 差异化对比
•版本目录差异对比:
三、安装部署
在安装Atlas之前需要先安装一下环境(Atlas默认使用索引引擎是Solr,我们这里更改成ES)。
3.1 安装Atlas(这个安装是把Ambari集成的Atlas1.1.0升级到2.2.0的安装方法)
1、把Atlas编译后的包放到服务器下的/DATA/apache-atlas-2.2.0并解压
2、在/usr/hdp/3.1.4.0-315下的atlas进行备份(atlas-bak)并删除原始的atlas
3、并把atlas软连接到/DATA/apache-atlas-2.2.0(ln -s /DATA/apache-atlas-2.2.0 atlas)(可以把atlas的中的内容直接换成atlas2.2.0)
4、并把atlas2.2.0中的conf目录指向/etc/atlas/3.1.4.0-315/0(ln -s /etc/atlas/3.1.4…0-315/0 conf)
5、在ambari中重新启动atlas
注:需要在每一台服务器上进行前四步操作
3.2 Atals配置
3.2.1 Atlas集成HBase
1、修改Atlas的conf中的atlas-application.properties配置文件中的以下参数
atlas.graph.storage.hostname=服务器1:2181,服务器2:2181,服务器3:2181
Ambari默认的Hbase(可以不需要修改)
2、修改Atlas的conf中的atlas-env.sh
atlas.hbase.conf.dir=/etc/hbase/conf
3.2.2 Atlas集成ES
1、修改Atlas中的atlas-application.properties配置文件中的以下参数
atlas.graph.index.search.backend=elasticsearch
atlas.graph.index.search.elasticsearch.client-only=true
atlas.graph.index.search.elasticsearch.http.auth.basic.password=atlas.graph.index.search.elasticsearch.http.auth.basic.username=
atlas.graph.index.search.elasticsearch.http.auth.type=basic
atlas.graph.index.search.hostname=服务器:9200
atlas.graph.index.search.solr.wait-searcher=false
3.2.3 Atlas集成Kafka
1、修改Atlas中的atlas-application.properties配置文件中的以下参数(如果使用Ambari集成改配置需要在其他问题的3中进行配置)
atlas.kafka.bootstrap.servers=服务器1:9092,服务器2:9092
atlas.kafka.hook.group.id=atlas
atlas.kafka.zookeeper.connect=服务器1:2181
atlas.kafka.auto.commit.interval.ms=1000
atlas.kafka.enable.auto.commit=false
atlas.kafka.auto.offset.reset=earliest
atlas.kafka.session.timeout.ms=30000
atlas.kafka.offsets.topic.replication.factor=1
atlas.kafka.poll.timeout.ms=1000
atlas.notification.create.topics=true
atlas.notification.replicas=1
atlas.notification.topics=ATLAS_HOOK,ATLAS_ENTITIES
atlas.notification.log.failed.messages=true
atlas.notification.consumer.retry.interval=500
atlas.notification.hook.retry.interval=1000
atlas.kafka.data= ${sys:atlas.home}/data/kafka
Ambari默认的Kafka配置
3.2.4 Atlas Server配置
1、修改Atlas中的atlas-application.properties配置文件中的以下参数
######### Server Properties ########
atlas.rest.address=服务器:21000
atlas.server.run.setup.on.start=false
######### Entity Audit Configs #########
atlas.audit.hbase.tablename=ATLAS_ENTITY_AUDIT_EVENTS
atlas.audit.zookeeper.session.timeout.ms=1000
atlas.audit.hbase.zookeeper.quorum=服务器1,服务器2,服务器3
3.2.5 Atlas集成Hive
1、修改Atlas的atlas-application.preperties配置文件中的以下参数
atlas.hook.hive.synchronous=false
atlas.hook.hive.numRetries=3
atlas.hook.hive.queueSize=10000
atlas.cluster.name=primary
2、修改Hive配置文件
修改hive-site.xml文件,配置Hive Hook
hive.exec.post.hooks=org.apache.hadoop.hive.ql.hooks.HiveProtoLoggingHook,org.apache.atlas.hive.hook.HiveHook
3、安装Hive Hook
Hive Hook已被编译到Atlas中,解压即可以用,这里不做过多的赘述。
4、修改hive-env.sh文件
export HIVE_AUX_JARS_PATH=/usr/hdp/3.1.4.0-315/atlas/hook/hive
5、将Atlas中的atlas.application.properties文件拷贝到Hive的conf目录下(在默认的情况下,hive下会有一个atlas.application.properties,而修改这个文件在hive配置中进行修改即可)
3.3Atlas启动前操作
1、在启动前,删除hbase中创建的表(先使表失效,然后删除表,最后需要让表生效),启动Atlas。(在进行es索引转换,kafka配置的时候都需要先删除hbase中的数据)
disable ‘namespace:table’ – 使表失效
drop ‘namespace:table’ – 删除表
enable ‘namespace:table’ – 使表生效
其他常见hbase语句
list – 查看所有的用户表
describe ‘namespace:table’ – 查看表的详情
is_enabled ‘namespace:table’ – 判断表是否生效
scan ‘namespace:table’ – 扫描表数据
delete ‘namespace:table’ – 删除表数据
PowerShell
truncate会把表分区也清除掉
truncate ‘namespace:tableName’
truncate_preserve只清除数据
truncate_preserve ‘namespace:tableName’
删除表中的所有单元格,命令格式如下:
deleteall ‘tablename’,‘row’
注:这步主要用于Ambari集成Atlas1.1.0并升级Atlas2.2.0的时候进行配置
2、在启动前需要把Ambari集成的Atlas页面上删除关于solr的配置。
3.4 启动Atlas
可以在Ambari中直接启动Atlas
3.5 验证Atlas
访问WebUI界面
服务器:21000
四、Atlas的使用
4.1 初次到入元数据(全量导入元数据)
执行atlas中的bin的import-hive.sh
./import-hive.sh
注:在进行导入的时候需要切换为hdfs用户去执行./import-hive.sh
4.2 增量导入
Atlas可以自动检测HIve中的操作进行实时的更新,也就是Atlas可以获取DML语句来得到数据之间的血缘关系。
五、Atlas性能配置
1、如果存储的元数据的数量较多,需要修改最佳的JVM GC性能。
修改atlas-env.sh配置文件
Bash
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.8时
export ATLAS_SERVER_HEAP="-Xms15360m -Xmx15360m -
XX:MaxNewSize=5120m -XX:MetaspaceSize=100M -
XX:MaxMetaspaceSize=512m"
– 参数说明:-XX:SoftRefLRUPolicyMSPerMB 此参数对管理具有许多并发用户的查询繁
重工作负载的 GC 性能特别有用。
六、配置用户名密码
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,如果第一个配置失败,则身份验证会进行第二个方法进行验证
七、Atlas安装常见问题
1、导入全量或者增量数据不成功
在启动之后,再次关闭Atlas,删除hbase中创建的表(先使表失效,然后删除表,最后需要让表生效),启动Atlas。(在进行es索引转换,kafka配置的时候都需要先删除hbase中的数据)
disable ‘namespace:table’ – 使表失效
drop ‘namespace:table’ – 删除表
enable ‘namespace:table’ – 使表生效
其他常见hbase语句
list – 查看所有的用户表
describe ‘namespace:table’ – 查看表的详情
is_enabled ‘namespace:table’ – 判断表是否生效
scan ‘namespace:table’ – 扫描表数据
delete ‘namespace:table’ – 删除表数据
2、如果使用kerberos去集成Atlas,需要修改Atlas的atlas-application.properties文件
默认配置:
atlas.authentication.method.kerberos=false
atlas.authentication.method.file=true
修改后配置:
atlas.authentication.method.kerberos=true
atlas.authentication.method.file=true
3、报错信息如下
解决方案:
如果执行这个错,需要验证两个问题:1、Atlas的安装包是正确的,2、查看ES中是否有建立了提示中的mapping。如果有需要删除ES的这个mapping并重新Atlas,就没有这个问题了。
4、报错信息如下
解决方案:
修改红框的参数为simple
5、报错内容如下
解决方案:
在进行导入的时候需要切换为hdfs用户去执行./import-hive.sh再去执行就可以解决。
su hdfs
./import-hive.sh
6、报错内容如下
解决方案:
1、在Ambari中暂停Atlas服务
2、进入hbase客户端中,删除Atlas建立的表(需要先失效)
八、其他问题
1、Atlas中atlas-aplication.properties完整版配置文件(生产环境)
CoffeeScript
######### Graph Database Configs #########
Graph Database
atlas.graph.storage.backend=hbase2
atlas.graph.storage.hbase.table=apache_atlas_janus
atlas.graph.storage.hostname=服务器:2181
atlas.graph.storage.hbase.regions-per-server=1
atlas.graph.storage.lock.wait-time=10000
atlas.EntityAuditRepository.impl=org.apache.atlas.repository.audit.HBaseBasedAuditRepository
Graph Search Index
atlas.graph.index.search.backend=elasticsearch
atlas.graph.index.search.hostname=服务器1:9200,服务器2:9200,服务器3:9200
atlas.graph.index.search.elasticsearch.client-only=true
atlas.graph.index.search.elasticsearch.http.auth.type=basic
atlas.graph.index.search.elasticsearch.http.auth.basic.username=
atlas.graph.index.search.elasticsearch.http.auth.basic.password=
atlas.graph.index.search.solr.wait-searcher=false
atlas.graph.index.search.max-result-set-size=150
######### Import Configs #########
######### Notification Configs #########
atlas.notification.embedded=false
atlas.kafka.data=${sys:atlas.home}/data/kafka # 需要修改的路径
atlas.kafka.zookeeper.connect=服务器1:2181,服务器2:2181,服务器3:2181
atlas.kafka.bootstrap.servers=服务器1:9092,服务器2:9092,服务器3:9092,服务器4:9092,服务器5:9092
生产端kafkaIp
atlas.kafka.bootstrap.servers=服务器1:9092,服务器2:9092,服务器3:9092,服务器4:9092,服务器5:9092
atlas.kafka.zookeeper.session.timeout.ms=400
atlas.kafka.zookeeper.connection.timeout.ms=200
atlas.kafka.zookeeper.sync.time.ms=20
atlas.kafka.auto.commit.interval.ms=1000
atlas.kafka.hook.group.id=atlas
atlas.kafka.enable.auto.commit=false
atlas.kafka.auto.offset.reset=earliest
atlas.kafka.session.timeout.ms=30000
atlas.kafka.offsets.topic.replication.factor=1
atlas.kafka.poll.timeout.ms=1000
atlas.notification.create.topics=true
atlas.notification.replicas=1
atlas.notification.topics=ATLAS_HOOK,ATLAS_ENTITIES
atlas.notification.log.failed.messages=true
atlas.notification.consumer.retry.interval=500
atlas.notification.hook.retry.interval=1000
Server port configuration
atlas.server.http.port=21000
SSL config
atlas.enableTLS=false
Authentication config
atlas.authentication.method.kerberos=true
atlas.authentication.method.file=true
ldap.type= LDAP or AD
atlas.authentication.method.ldap.type=none
user credentials file
atlas.authentication.method.file.filename=${sys:atlas.home}/conf/users-credentials.properties
######### Server Properties #########
atlas.rest.address=http://localhost:21000
######### Entity Audit Configs #########
atlas.audit.hbase.tablename=apache_atlas_entity_audit
atlas.audit.zookeeper.session.timeout.ms=1000
atlas.audit.hbase.zookeeper.quorum=服务器1:2181,服务器2:2181,服务器3:2181 # 需要修改
######### High Availability Configuration #########
atlas.server.ha.enabled=false
########## CSRF Configs ##########
atlas.rest-csrf.enabled=true
atlas.rest-csrf.browser-useragents-regex=Mozilla.*,Opera.,^Chrome.
atlas.rest-csrf.methods-to-ignore=GET,OPTIONS,HEAD,TRACE
atlas.rest-csrf.custom-header=X-XSRF-HEADER
############ Atlas Metric/Stats configs #############
Format: atlas.metric.query..
atlas.metric.query.cache.ttlInSecs=900
#Set to false to disable gremlin search.
atlas.search.gremlin.enable=false
######### UI Configuration ##########
atlas.ui.default.version=v1
########## Hive Hook Config ##########
atlas.hook.hive.synchronous=false
atlas.hook.hive.numRetries=3
atlas.hook.hive.queueSize=10000
atlas.cluster.name=primary
2、Atlas中atlas-env.xml文件完整版(生产环境)
Bash
export JAVA_HOME=/usr/java/jdk1.8.0_102
export HBASE_CONF_DIR=/etc/hbase/conf
需要注意这个配置和Atlas1.1.0的配置不一样 atlas.hbase.conf.dir=/etc/hbase/conf
export ATLAS_LOG_DIR=/var/log/atlas2.2
export ATLAS_PID_DIR=/DATA/apache-atlas-2.2.0
export ATLAS_DATA_DIR=/DATA/apache-atlas-2.2.0/data
export MANAGE_LOCAL_HBASE=false
export MANAGE_LOCAL_SOLR=false
export MANAGE_EMBEDDED_CASSANDRA=false
export MANAGE_LOCAL_ELASTICSEARCH=false
3、Ambari集成Atlas的hive hook说明。
在使用Ambari集成Atlas的时候。在增量的时候需要在Hive中相应的配置文件中设置相应的kafka配置。(增量元数据流程:Hive->Hive Hook->Kafka)
在Ambari中已经集成了Hive Hook的配置,这个配置是在Hive的配置中。
4、重点
如果修改Atlas的atlas-application.properties中的配置,一定要修改hive中的hive-atlas-application.properties,这两个文件一定要同步。
eg:如果想要给Atlas中的kafka换一个topic,修改Atlas中的配置只会让Kafka中存在这个topic,但是数据还是发送不到指定的topic,只有修改了Hive中的的配置才能使数据真正的发送到指定的topic中。修改参数是(如下所示):
Fortran
atlas.notification.topics=ATLAS_HOOK,ATLAS_ENTITIES
atlas.notification.log.failed.messages=true
atlas.notification.hook.topic.name=ATLAS_HOOK
atlas.notification.entities.topic.name=ATLAS_ENTITIES
注:以上三个配置要在Atlas和Hive中都要增加