Atlas配置Hive Hook
-
配置
hive-site.xml
在
Hive
客户端$HIVE_HOME/conf/hive-site.xml
中加入内容:<property> <name>hive.exec.post.hooks</name> <value>org.apache.atlas.hive.hook.HiveHook</value> </property>
-
解压
hive-hook
包解压
hook
包(这里以hive-hook
为例),并拷贝内容到atlas
安装目录下tar -zxvf apache-atlas-2.2.0-hive-hook.tar.gz -C /opt/atlas/atlas
-
修改
Hive-env.sh
[root@dc6-80-283 conf]# cd /opt/hive/hive/conf [root@dc6-80-283 conf]# cp hive-env.sh.template hive-env.sh [root@dc6-80-283 conf]# vim hive-env.sh # 加入内容 export HIVE_AUX_JARS_PATH=/opt/atlas/atlas/hook/hive/
然后重启
hive
-
复制
ATLAS_HOME/conf/atlas-application.properties
到HIVE_HOME/conf
目录下cp /opt/atlas/atlas/conf/atlas-application.properties /opt/hive/hive/conf/
-
执行同步Hive元数据脚本
# 这里同步的是Hive中已有数据的元数据,可以通过此脚本同步过来 [root@dc6-80-283 ]# cd /opt/atlas/atlas/hook-bin/ # 执行脚本导入元数据,期间需要输入atlas的用户名和密码:admin/admin [root@dc6-80-283 ]# import-hive.sh
2022-06-29T19:30:02,605 INFO [main] com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting... 2022-06-29T19:30:02,612 WARN [main] com.zaxxer.hikari.util.DriverDataSource - Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation. 2022-06-29T19:30:03,057 INFO [main] com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed. 2022-06-29T19:30:03,090 INFO [main] com.zaxxer.hikari.HikariDataSource - HikariPool-2 - Starting... 2022-06-29T19:30:03,091 WARN [main] com.zaxxer.hikari.util.DriverDataSource - Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation. 2022-06-29T19:30:03,118 INFO [main] com.zaxxer.hikari.HikariDataSource - HikariPool-2 - Start completed. 2022-06-29T19:30:03,212 INFO [main] org.apache.hadoop.hive.metastore.ObjectStore - Setting MetaStore object pin classes with hive.metastore.cache.pinobjtypes="Table,StorageDescriptor,SerDeInfo,Partition,Database,Type,FieldSchema,Order" 2022-06-29T19:30:03,336 INFO [main] org.apache.hadoop.hive.metastore.MetaStoreDirectSql - Using direct SQL, underlying DB is MYSQL 2022-06-29T19:30:03,339 INFO [main] org.apache.hadoop.hive.metastore.ObjectStore - Initialized ObjectStore 2022-06-29T19:30:03,519 WARN [main] DataNucleus.MetaData - Metadata has jdbc-type of null yet this is not valid. Ignored 2022-06-29T19:30:03,519 WARN [main] DataNucleus.MetaData - Metadata has jdbc-type of null yet this is not valid. Ignored 2022-06-29T19:30:03,520 WARN [main] DataNucleus.MetaData - Metadata has jdbc-type of null yet this is not valid. Ignored 2022-06-29T19:30:03,520 WARN [main] DataNucleus.MetaData - Metadata has jdbc-type of null yet this is not valid. Ignored 2022-06-29T19:30:03,520 WARN [main] DataNucleus.MetaData - Metadata has jdbc-type of null yet this is not valid. Ignored 2022-06-29T19:30:03,520 WARN [main] DataNucleus.MetaData - Metadata has jdbc-type of null yet this is not valid. Ignored 2022-06-29T19:30:04,637 WARN [main] DataNucleus.MetaData - Metadata has jdbc-type of null yet this is not valid. Ignored 2022-06-29T19:30:04,637 WARN [main] DataNucleus.MetaData - Metadata has jdbc-type of null yet this is not valid. Ignored 2022-06-29T19:30:04,638 WARN [main] DataNucleus.MetaData - Metadata has jdbc-type of null yet this is not valid. Ignored 2022-06-29T19:30:04,638 WARN [main] DataNucleus.MetaData - Metadata has jdbc-type of null yet this is not valid. Ignored 2022-06-29T19:30:04,638 WARN [main] DataNucleus.MetaData - Metadata has jdbc-type of null yet this is not valid. Ignored 2022-06-29T19:30:04,638 WARN [main] DataNucleus.MetaData - Metadata has jdbc-type of null yet this is not valid. Ignored 2022-06-29T19:30:06,176 INFO [main] org.apache.hadoop.hive.metastore.HiveMetaStore - Added admin role in metastore 2022-06-29T19:30:06,180 INFO [main] org.apache.hadoop.hive.metastore.HiveMetaStore - Added public role in metastore 2022-06-29T19:30:06,201 INFO [main] org.apache.hadoop.hive.metastore.HiveMetaStore - No user is added in admin role, since config is empty 2022-06-29T19:30:06,347 INFO [main] org.apache.hadoop.hive.metastore.RetryingMetaStoreClient - RetryingMetaStoreClient proxy=class org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient ugi=root (auth:SIMPLE) retries=1 delay=1 lifetime=0 2022-06-29T19:30:06,374 INFO [main] org.apache.hadoop.hive.metastore.HiveMetaStore - 0: get_all_functions 2022-06-29T19:30:06,376 INFO [main] org.apache.hadoop.hive.metastore.HiveMetaStore.audit - ugi=root ip=unknown-ip-addr cmd=get_all_functions 2022-06-29T19:30:06,406 INFO [main] org.apache.atlas.hive.bridge.HiveMetaStoreBridge - Importing Hive metadata 2022-06-29T19:30:06,406 INFO [main] org.apache.hadoop.hive.metastore.HiveMetaStore - 0: get_databases: @hive# 2022-06-29T19:30:06,407 INFO [main] org.apache.hadoop.hive.metastore.HiveMetaStore.audit - ugi=root ip=unknown-ip-addr cmd=get_databases: @hive# 2022-06-29T19:30:06,413 INFO [main] org.apache.atlas.hive.bridge.HiveMetaStoreBridge - Found 1 databases 2022-06-29T19:30:06,413 INFO [main] org.apache.hadoop.hive.metastore.HiveMetaStore - 0: get_database: @hive#default 2022-06-29T19:30:06,413 INFO [main] org.apache.hadoop.hive.metastore.HiveMetaStore.audit - ugi=root ip=unknown-ip-addr cmd=get_database: @hive#default 2022-06-29T19:30:06,459 INFO [main] org.apache.atlas.AtlasBaseClient - method=GET path=api/atlas/v2/entity/uniqueAttribute/type/ contentType=application/json; charset=UTF-8 accept=application/json status=200 2022-06-29T19:30:06,717 INFO [main] org.apache.atlas.hive.bridge.HiveMetaStoreBridge - Database default is already registered - id=07cf307a-613f-42d2-bf33-12fd26e3bd67. Updating it. 2022-06-29T19:30:06,784 INFO [main] org.apache.atlas.AtlasBaseClient - method=POST path=api/atlas/v2/entity/ contentType=application/json; charset=UTF-8 accept=application/json status=200 2022-06-29T19:30:06,793 INFO [main] org.apache.atlas.hive.bridge.HiveMetaStoreBridge - Updated hive_db entity: name=default@primary, guid=07cf307a-613f-42d2-bf33-12fd26e3bd67 2022-06-29T19:30:06,809 INFO [main] org.apache.hadoop.hive.metastore.HiveMetaStore - 0: get_tables: db=@hive#default pat=.* 2022-06-29T19:30:06,809 INFO [main] org.apache.hadoop.hive.metastore.HiveMetaStore.audit - ugi=root ip=unknown-ip-addr cmd=get_tables: db=@hive#default pat=.* 2022-06-29T19:30:06,813 INFO [main] org.apache.atlas.hive.bridge.HiveMetaStoreBridge - Found 1 tables to import in database default 2022-06-29T19:30:06,815 INFO [main] org.apache.hadoop.hive.metastore.HiveMetaStore - 0: get_table : tbl=hive.default.t_order 2022-06-29T19:30:06,815 INFO [main] org.apache.hadoop.hive.metastore.HiveMetaStore.audit - ugi=root ip=unknown-ip-addr cmd=get_table : tbl=hive.default.t_order 2022-06-29T19:30:06,944 INFO [main] org.apache.atlas.AtlasBaseClient - method=GET path=api/atlas/v2/entity/uniqueAttribute/type/ contentType=application/json; charset=UTF-8 accept=application/json status=200 2022-06-29T19:30:06,945 INFO [main] org.apache.atlas.hive.bridge.HiveMetaStoreBridge - Table default.t_order is already registered with id 63fb7492-0c8d-4185-b556-8a7a3c6b8f5c. Updating entity. 2022-06-29T19:30:07,052 INFO [main] org.apache.atlas.AtlasBaseClient - method=POST path=api/atlas/v2/entity/ contentType=application/json; charset=UTF-8 accept=application/json status=200 2022-06-29T19:30:07,053 INFO [main] org.apache.atlas.hive.bridge.HiveMetaStoreBridge - Updated hive_table entity: name=default.t_order@primary, guid=63fb7492-0c8d-4185-b556-8a7a3c6b8f5c 2022-06-29T19:30:07,053 INFO [main] org.apache.atlas.hive.bridge.HiveMetaStoreBridge - Successfully imported 1 tables from database default Hive Meta Data imported successfully!!! [root@dc6-80-283 hook-bin]#
-
可以看到成功导入了数据表
t_order
2022-06-29T19:30:06,813 INFO [main] org.apache.atlas.hive.bridge.HiveMetaStoreBridge - Found 1 tables to import in database default 2022-06-29T19:30:06,815 INFO [main] org.apache.hadoop.hive.metastore.HiveMetaStore - 0: get_table : tbl=hive.default.t_order
-
查看
Atlas Web
页面