Atlas配置Hive Hook

Atlas配置Hive Hook

  1. 配置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>
    
  2. 解压hive-hook

    解压hook包(这里以hive-hook为例),并拷贝内容到atlas安装目录下

    tar -zxvf apache-atlas-2.2.0-hive-hook.tar.gz -C /opt/atlas/atlas
    
  3. 修改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

  4. 复制ATLAS_HOME/conf/atlas-application.propertiesHIVE_HOME/conf目录下

    cp /opt/atlas/atlas/conf/atlas-application.properties /opt/hive/hive/conf/
    
  5. 执行同步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]# 
    
  6. 可以看到成功导入了数据表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
    
  7. 查看Atlas Web页面

    在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值