- 编译。
- 在官网下载好需要的包之后进行编译,这部分基本看官方安装文档就行。需要注意的是maven版本3.6以上的话,1.1和1.0编译会报错,本人亲试。1.2和2.0两个版本个人体验好像没什么差别,只有配置文件有点不一样(2.0是hbase2),其他地方都一样,连官网的文档都一样。一开始装2.0出错以为是版本问题,之后装的是1.2版本。另外我使用的是集群已有的ES和hbase,不用solr。下面是编译命令。
tar xvfz apache-atlas-1.2.0-sources.tar.gz cd apache-atlas-sources-1.2.0/ export MAVEN_OPTS="-Xms2g -Xmx2g" mvn clean -DskipTests install mvn clean -DskipTests package -Pdist
- 在官网下载好需要的包之后进行编译,这部分基本看官方安装文档就行。需要注意的是maven版本3.6以上的话,1.1和1.0编译会报错,本人亲试。1.2和2.0两个版本个人体验好像没什么差别,只有配置文件有点不一样(2.0是hbase2),其他地方都一样,连官网的文档都一样。一开始装2.0出错以为是版本问题,之后装的是1.2版本。另外我使用的是集群已有的ES和hbase,不用solr。下面是编译命令。
- 安装。
- 经过漫长的等待,编译完成之后我们进入apache-atlas-sources-1.2.0/distro/target下,可以看到很多包,这里不需要像官网一样去解压,其实都解压好了,未解压的就当作是备份就好了。
- 进入apache-atlas-1.2.0-server/apache-atlas-1.2.0,开始修改conf下的atlas-application.properties,最好先备份下。
- 配置这里我贴在下面,IP改成自己集群就行,这里有点不一样的是ES的一个参数atlas.graph.index.search.hostname,官方的包编译完是atlas.graph.index.hostname,不加search就会报错,找不到es。另外,我没有配高可用。
atlas.graph.storage.backend=hbase atlas.graph.storage.hbase.table=atlas atlas.graph.storage.hostname=IP1,IP2,IP3 atlas.graph.storage.hbase.regions-per-server=1 atlas.graph.storage.lock.wait-time=10000 atlas.EntityAuditRepository.impl=org.apache.atlas.repository.audit.HBaseBasedAuditRepository atlas.graph.index.search.backend=elasticsearch atlas.graph.index.search.hostname=IP1,IP2,IP3 atlas.graph.index.search.elasticsearch.client-only=true atlas.graph.index.search.max-result-set-size=150 atlas.notification.embedded=false atlas.kafka.data=${sys:atlas.home}/data/kafka atlas.kafka.zookeeper.connect=IP1:2181,IP2:2181,IP3:2181 atlas.kafka.bootstrap.servers=IP1:9092,IP2:9092,IP3:9092 atlas.kafka.zookeeper.session.timeout.ms=400 atlas.kafka.zookeeper.connection.timeout.ms=30000 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=60000 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.enableTLS=false atlas.authentication.method.kerberos=false atlas.authentication.method.file=true atlas.authentication.method.ldap.type=none atlas.authentication.method.file.filename=${sys:atlas.home}/conf/users-credentials.properties atlas.rest.address=http://localhost:21000 atlas.audit.hbase.tablename=apache_atlas_entity_audit atlas.audit.zookeeper.session.timeout.ms=1000 atlas.audit.hbase.zookeeper.quorum=IP1:2181,IP2:2181,IP3:2181 atlas.server.ha.enabled=false atlas.authorizer.impl=simple atlas.authorizer.simple.authz.policy.file=atlas-simple-authz-policy.json 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.query.cache.ttlInSecs=900 atlas.search.gremlin.enable=false atlas.cluster.name=primary atlas.hook.hive.synchronous=false atlas.hook.hive.numRetries=3 atlas.hook.hive.queueSize=10000
-
之后就把apache-atlas-1.2.0-hive-hook/apache-atlas-hive-hook-1.2.0下面的hook和hook-bin复制到apache-atlas-1.2.0-server/apache-atlas-1.2.0下面。因为文件路径太深,建议在外面做个软连接,我在/opt目录下建了个。如下:
ln -s ~/apache-atlas-sources-1.2.0/distro/target/apache-atlas-1.2.0-server/apache-atlas-1.2.0 atlas
-
之后就在/opt/atlas下操作了
-
import-hive
-
需要将atlas-application.properties复制到每个hive节点的conf下才能运行,不然会报错。如下:
ERROR org.apache.atlas.hive.bridge.HiveMetaStoreBridge - Import failed org.apache.atlas.AtlasException: Failed to load application properties
-
./bin/atlas-start.py可以查看/logs/application.log看看有没有啥问题,第一次启动初始化需要一段时间。
-
这里就出现了个问题,import-hive.sh导入成功之后,只有外部表能看到血缘关系,内部表视图等都看不到血缘关系,且对表的删改看不出变化。这是因为没有hook,import-hive只是一个初始化hive元数据动作,真正满足我们需求的,需要启动hook。
-
-
hive hook
-
这里就坑了我好久。hive的hook生效后,beeline一直报错,如下:
Error: Error running query: java.lang.NoClassDefFoundError: Could not initialize class org.apache.atlas.hive.hook.HiveHook
-
首先是配置hive hook
-
在CM管理界面找到hive配置部分,搜hive-site,在hive-site.xml 的 Hive 客户端高级配置代码段(安全阀)这里添加参数
- 搜索HIVE_AUX_JARS_PATH,添加你的hook的位置,记得=》在每个hive节点上都要有这个目录和jar包。
- 重启atlas后就生效了。但是这只是hive生效,hive2不生效,也就是beeline使用的时候会报错。
- 需要把atlas-application.properties打入atlas-plugin-classloader-1.2.0.jar不然beeline连接hiveserver2的时候调用hook会找不到配置文件!注意要在同级目录打包!这里我也犯错了,不然atlas-application.properties不会在jar包里的第一级目录,还是会找不到!
zip -u atlas-plugin-classloader-1.2.0.jar atlas-application.properties
- hiveserver2也要配置,搜hive-site,在hive-site.xml 的 HiveServer2 高级配置代码段(安全阀)下配置,想要beeline需要配置hive.reloadable.aux.jars.path参数。
- 搜hiveserver,翻到最后一页,这里也添加上hook依赖的jar包
-
-
下面是hive-import的时候报错的内容:
Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/jaxrs/json/JacksonJaxbJsonProvider
at org.apache.atlas.AtlasBaseClient.getClient(AtlasBaseClient.java:270)
at org.apache.atlas.AtlasBaseClient.initializeState(AtlasBaseClient.java:453)
at org.apache.atlas.AtlasBaseClient.initializeState(AtlasBaseClient.java:448)
at org.apache.atlas.AtlasBaseClient.<init>(AtlasBaseClient.java:132)
at org.apache.atlas.AtlasClientV2.<init>(AtlasClientV2.java:82)
at org.apache.atlas.hive.bridge.HiveMetaStoreBridge.main(HiveMetaStoreBridge.java:131)
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 6 more
Failed to import Hive Meta Data!!!
解决办法:
去maven仓库下载,jackson-jaxrs-base-2.9.9.jar,jackson-jaxrs-json-provider-2.9.9.jar,jackson-module-jaxb-annotations-2.9.9.jar放到hook/hive/atlas-hive-plugin-impl下面就可以了