点击上方蓝色字体,选择“设为星标”
回复"面试"获取更多惊喜
Hi,我是王知无,一个大数据领域的原创作者。
放心关注我,获取更多行业的一手消息。
1.1 执行SQL
1.2 手写的数据地图
1.3 atlas血缘分析
1.4 打标签
1.4.1 CLASSIFICATION分类
1.4.2 GLOSSARY词汇表
1.5 字段搜索
1.5.1查看表字段
1.5.2 追踪字段关系
2.1 编译安装
2.1.1 下载源码
2.1.2 组件修改版本
2.1.3 修改报错代码
2.1.4 编译
2.1.5 编译包
2.1.6 复制包
2.1.7 解压
2.2 部署
2.2.1 修改配置
2.2.2 配置环境变量
3.1 启动
3.2 访问
4.1 Hive Hook
4.1.1 设置Atlas配置目录
4.1.2 设置环境变量
4.1.3 把压缩包上传
4.1.4 解压包
4.1.5 添加Hive的第三方依赖包
4.1.6 导入Hive数据
4.1.7 压缩配置文件到 Jar
4.1.8 软连接 Atlas hook 文件
4.1.9 修改hive-site.xml,配置Hive Hook
4.1.10 重启Hive
4.2 Sqoop Hook
4.2.1 设置Atlas配置目录
4.2.2 设置环境变量
4.2.3 把压缩包上传
4.2.4 解压包
4.2.5 压缩配置文件到 Jar
4.2.6 软连接 Sqoop hook 文件
4.2.7 修改sqoop-site.xml,配置Sqoop Hook
--创建临时表(取出最新一条访问记录)
DROP TABLE IF EXISTS tmp.tmp_ng;
CREATE TABLE tmp.tmp_ng STORED AS parquet AS
SELECT userid,pageid,pagetype,os,terminal_type,pagetime
FROM (SELECT uid userid,CAST(pageid AS INT) pageid,pagetype,os,terminal_type,pagetime,row_number() OVER(PARTITION BY uid,pageidORDER BY pagetime DESC) rkFROM dw.dw_nginxlogWHERE dt = '2020-11-02') t1
WHERE rk = 1 --用户访问各个页面的及设备
;
--统计三个页面的访问及设备
INSERT OVERWRITE TABLE dwd.dwd_hive_fact_nginx_visit_ext_dt PARTITION(dt = '2020-11-03')
SELECT zbid,userid,os,terminal_type
FROM (SELECT zbid,userid,os,terminal_type,row_number() OVER(PARTITION BY zbid,useridORDER BY pagetime DESC) rkFROM (SELECT tp.zbid,t1.userid,t1.os,t1.terminal_type,t1.pagetimeFROM (SELECT userid,pageid,os,terminal_type,pagetimeFROM tmp.tmp_ngWHERE pagetype = 1 --话题类型) t1LEFT JOIN (SELECT zbid,topicidFROM dwd.dwd_minisns_zbtopics_dsWHERE dt = '2020-11-02') tp --快照表ON t1.pageid = tp.topicidUNION ALLSELECT tp.zbid,t2.userid,t2.os,t2.terminal_type,t2.pagetimeFROM (SELECT userid,pageid,os,terminal_type,pagetimeFROM tmp.tmp_ngWHERE pagetype = 2 --频道类型) t2LEFT JOIN dw.dw_zbchannel tp ON t2.pageid = tp.channelid) t3) t4
WHERE rk = 1;
说明:通过对比,Atlas能够更加准确地解析所有脚本SQL语句,在全局角度能够看到上下游关系,不过自己手动维护的好处的是能够更加方便地迭代维护。可以通过自己对表的理解划分到不同的域和维度,方便维护。
1.4.1 CLASSIFICATION分类
说明:按自己项目的需求划分不同得维度
1.4.2 GLOSSARY词汇表
说明:一个数据仓库项目有很多域,域下面还有很多层次,可以按自己项目需求规划。
1.5.1查看表字段
1.5.2 追踪字段关系
说明:强大地血缘关系可以直接查看出整条字段的数据链路。
2.1.1 下载源码
git clone --branch branch-2.0 https://gitee.com/mirrors/apache-atlas.git apache-atlas_branch-2.0
2.1.2 组件修改版本
注意:
去除 pom.xml 的 hbase-zookeeper 依赖
2.1.3 修改报错代码
hbase2.X --> hbase1.X
ColumnFamilyDescriptor --> HColumnDescriptor
TableDescriptor --> HTableDescriptor
2.1.4 编译
export MAVEN_OPTS="-Xms2g -Xmx2g"
mvn clean package -Pdist -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dmaven.source.skip=true
2.1.5 编译包
distro/target/apache-atlas-{project.version}-bin.tar.gz
distro/target/apache-atlas-{project.version}-falcon-hook.tar.gz
distro/target/apache-atlas-{project.version}-hbase-hook.tar.gz
distro/target/apache-atlas-{project.version}-hive-hook.gz
distro/target/apache-atlas-{project.version}-impala-hook.gz
distro/target/apache-atlas-{project.version}-kafka-hook.gz
distro/target/apache-atlas-{project.version}-server.tar.gz
distro/target/apache-atlas-{project.version}-sources.tar.gz
distro/target/apache-atlas-{project.version}-sqoop-hook.tar.gz
distro/target/apache-atlas-{project.version}-storm-hook.tar.gz
2.1.6 复制包
mkdir -p /opt/package/atlas/
安装 nc
yum install nc -ync -l 33880 > /opt/package/atlas/apache-atlas-2.2.0-SNAPSHOT-bin.tar.gznc 10.0.11.10 33880 < /data/build/apache-atlas/distro/target/apache-atlas-2.2.0-SNAPSHOT-bin.tar.gz
2.1.7 解压
mkdir -p /opt/service/atlas/
rm -rf /opt/service/atlas/apache-atlas-2.2.0-SNAPSHOT
tar -zxf /opt/package/atlas/apache-atlas-2.2.0-SNAPSHOT-bin.tar.gz -C /opt/service/atlas/
2.2.1 修改配置
进入conf 目录
vim atlas-env.sh
export JAVA_HOME&#61;/usr/local/jdkexport HBASE_CONF_DIR&#61;/usr/local/service/hbase/confexport ATLAS_SERVER_HEAP&#61;"-Xms2048m -Xmx15360m -XX:MaxNewSize&#61;5120m -XX:MetaspaceSize&#61;100M -XX:MaxMetaspaceSize&#61;512m"
vim atlas-application.properties
# hbase 配置
atlas.graph.storage.hbase.table&#61;apache_atlas_janus_testatlas.graph.storage.hostname&#61;10.0.11.6# 使用 elasticsearch 存储索引
atlas.graph.index.search.backend&#61;elasticsearch
atlas.graph.index.search.index-name&#61;test_janusgraph# elasticsearch 配置
# elasticsearch 地址
atlas.graph.index.search.hostname&#61;10.0.12.47,10.0.12.47:9201,10.0.12.47:9202
atlas.graph.index.search.elasticsearch.client-only&#61;true
atlas.graph.index.search.elasticsearch.http.auth.type&#61;basic
atlas.graph.index.search.elasticsearch.http.auth.basic.username&#61;elastic
atlas.graph.index.search.elasticsearch.http.auth.basic.password&#61;Qaz&#64;4321# kafak 配置
atlas.notification.embedded&#61;false
# atlas.kafka.data&#61;${sys:atlas.home}/data/kafka
atlas.kafka.zookeeper.connect&#61;10.0.11.6:2181
atlas.kafka.bootstrap.servers&#61;10.0.12.95:9092
atlas.kafka.zookeeper.session.timeout.ms&#61;400
atlas.kafka.zookeeper.connection.timeout.ms&#61;200
atlas.kafka.zookeeper.sync.time.ms&#61;20
atlas.kafka.auto.commit.interval.ms&#61;1000
atlas.kafka.hook.group.id&#61;atlasatlas.kafka.enable.auto.commit&#61;false
atlas.kafka.auto.offset.reset&#61;earliest
atlas.kafka.session.timeout.ms&#61;30000
atlas.kafka.offsets.topic.replication.factor&#61;2
atlas.kafka.poll.timeout.ms&#61;1000atlas.notification.hook.topic.name&#61;ATLAS_HOOK_TEST
atlas.notification.entities.topic.name&#61;ATLAS_ENTITIES_TESTatlas.notification.hook.consumer.topic.names&#61;ATLAS_HOOK_TEST
atlas.notification.entities.consumer.topic.names&#61;ATLAS_ENTITIES_TESTatlas.notification.create.topics&#61;false
atlas.notification.replicas&#61;2
atlas.notification.topics&#61;ATLAS_HOOK_TEST,ATLAS_ENTITIES_TEST
atlas.notification.log.failed.messages&#61;true
atlas.notification.consumer.retry.interval&#61;500
atlas.notification.hook.retry.interval&#61;1000# 服务地址
atlas.rest.address&#61;http://10.0.11.10:21000# hbase zookeeper地址
atlas.audit.hbase.tablename&#61;apache_atlas_entity_audit_test
atlas.audit.hbase.zookeeper.quorum&#61;10.0.11.6
atlas.audit.hbase.zookeeper.property.clientPort&#61;2181atlas.ui.default.version&#61;v2
vim atlas-log4j.xml
2.2.2 配置环境变量
vim /etc/profile
export ATLAS_HOME&#61;/opt/service/atlas/apache-atlas-2.2.0-SNAPSHOT
export PATH&#61;$PATH:$ATLAS_HOME/binexport JAVA_TOOL_OPTIONS&#61;"-Datlas.conf&#61;/opt/service/atlas/apache-atlas-2.2.0-SNAPSHOT/conf"
source /etc/profile
atlas_start.py
说明&#xff1a;第一次启动&#xff0c;开始初始化安装&#xff0c;需要大约一个小时
http://localhost:21000/
用户名&#xff1a;admin
密码&#xff1a;admin
说明&#xff1a;每个Hive节点都配置
4.1.1 设置Atlas配置目录
mkdir -p /opt/service/atlas/apache-atlas-2.2.0-SNAPSHOT/conf把安装Atlas节点 atlas-application.properties , atlas-env.sh , atlas-log4j.xml 拷贝放在conf目录下
4.1.2 设置环境变量
vim /etc/profileexport ATLAS_HOME&#61;/opt/service/atlas/apache-atlas-2.2.0-SNAPSHOT
export JAVA_TOOL_OPTIONS&#61;"-Datlas.conf&#61;/opt/service/atlas/apache-atlas-2.2.0-SNAPSHOT/conf"source /etc/profile
4.1.3 把压缩包上传
mkdir -p /opt/package/atlas/
#把压缩包上传到 /opt/package/atlas/ 目录下
安装nc
yum install nc -y
nc -l 33880 > /opt/package/atlas/apache-atlas-2.2.0-SNAPSHOT-hive-hook.tar.gz
nc 10.0.12.114 33880 < /data/build/apache-atlas/distro/target/apache-atlas-2.2.0-SNAPSHOT-hive-hook.tar.gz
4.1.4 解压包
mkdir -p /opt/service/atlas/apache-atlas-2.2.0-SNAPSHOTunalias rmrm -rf /opt/service/atlas/apache-atlas-2.2.0-SNAPSHOT/apache-atlas-hive-hook-2.2.0-SNAPSHOTtar -zxf /opt/package/atlas/apache-atlas-2.2.0-SNAPSHOT-hive-hook.tar.gz -C /opt/service/atlas/apache-atlas-2.2.0-SNAPSHOT
4.1.5 添加Hive的第三方依赖包
第三方依赖包目录&#xff1a; $HIVE_HOME/auxlib
4.1.5.1 elasticsearch-hive 依赖&#xff1a;
elasticsearch-hadoop-hive-7.1.0.jar移除 elasticsearch-hadoop.jar
4.1.5.2 Hive-kudu 依赖&#xff1a;
hive-kudu-handler-1.10.0.jar
4.1.6 导入Hive数据
cd /opt/service/atlas/apache-atlas-2.2.0-SNAPSHOT/apache-atlas-hive-hook-2.2.0-SNAPSHOT./hook-bin/import-hive.sh
说明&#xff1a;输入用户名和密码&#xff0c;大约两个小时就导完&#xff0c;视表的量决定
4.1.7 压缩配置文件到 Jar
cd $ATLAS_HOME/conf/zip -u $ATLAS_HOME/apache-atlas-hive-hook-2.2.0-SNAPSHOT/hook/hive/atlas-plugin-classloader-2.2.0-SNAPSHOT.jar atlas-application.properties
4.1.8 软连接 Atlas hook 文件
ln -s /opt/service/atlas/apache-atlas-2.2.0-SNAPSHOT/apache-atlas-hive-hook-2.2.0-SNAPSHOT/hook/hive/atlas-plugin-classloader-2.2.0-SNAPSHOT.jar /usr/local/service/hive/lib/atlas-plugin-classloader-2.2.0-SNAPSHOT.jarln -s /opt/service/atlas/apache-atlas-2.2.0-SNAPSHOT/apache-atlas-hive-hook-2.2.0-SNAPSHOT/hook/hive/hive-bridge-shim-2.2.0-SNAPSHOT.jar /usr/local/service/hive/lib/atlas-hive-bridge-shim-2.2.0-SNAPSHOT.jarln -s /opt/service/atlas/apache-atlas-2.2.0-SNAPSHOT/apache-atlas-hive-hook-2.2.0-SNAPSHOT/hook/hive/atlas-hive-plugin-impl /usr/local/service/hive/lib/atlas-hive-plugin-impl
4.1.9 修改hive-site.xml&#xff0c;配置Hive Hook
4.1.10 重启Hive
说明&#xff1a;每个Hive节点都配置
4.2.1 设置Atlas配置目录
mkdir -p /opt/service/atlas/apache-atlas-2.2.0-SNAPSHOT/conf
#把安装Atlas节点 atlas-application.properties , atlas-env.sh , atlas-log4j.xml 拷贝放在conf目录下
4.2.2 设置环境变量
vim /etc/profileexport ATLAS_HOME&#61;/opt/service/atlas/apache-atlas-2.2.0-SNAPSHOT
export JAVA_TOOL_OPTIONS&#61;"-Datlas.conf&#61;/opt/service/atlas/apache-atlas-2.2.0-SNAPSHOT/conf"source /etc/profile
4.2.3 把压缩包上传
mkdir -p /opt/package/atlas/#把压缩包上传到 /opt/package/atlas/ 目录下
安装nc
yum install nc -y
nc -l 33880 > /opt/package/atlas/apache-atlas-2.2.0-SNAPSHOT-sqoop-hook.tar.gz
nc 10.0.12.114 33880 < /data/build/apache-atlas/distro/target/apache-atlas-2.2.0-SNAPSHOT-sqoop-hook.tar.gz
4.2.4 解压包
mkdir -p /opt/service/atlas/apache-atlas-2.2.0-SNAPSHOTunalias rmrm -rf /opt/service/atlas/apache-atlas-2.2.0-SNAPSHOT/apache-atlas-sqoop-hook-2.2.0-SNAPSHOTtar -zxf /opt/package/atlas/apache-atlas-2.2.0-SNAPSHOT-sqoop-hook.tar.gz -C /opt/service/atlas/apache-atlas-2.2.0-SNAPSHOT
4.2.5 压缩配置文件到 Jar
cd $ATLAS_HOME/conf/zip -u $ATLAS_HOME/apache-atlas-sqoop-hook-2.2.0-SNAPSHOT/hook/sqoop/atlas-plugin-classloader-2.2.0-SNAPSHOT.jar atlas-application.properties
4.2.6 软连接 Sqoop hook 文件
ln -s /opt/service/atlas/apache-atlas-2.2.0-SNAPSHOT/apache-atlas-sqoop-hook-2.2.0-SNAPSHOT/hook/sqoop/atlas-plugin-classloader-2.2.0-SNAPSHOT.jar /usr/local/service/sqoop/lib/atlas-plugin-classloader-2.2.0-SNAPSHOT.jarln -s /opt/service/atlas/apache-atlas-2.2.0-SNAPSHOT/apache-atlas-sqoop-hook-2.2.0-SNAPSHOT/hook/sqoop/sqoop-bridge-shim-2.2.0-SNAPSHOT.jar /usr/local/service/sqoop/lib/atlas-sqoop-bridge-shim-2.2.0-SNAPSHOT.jarln -s /opt/service/atlas/apache-atlas-2.2.0-SNAPSHOT/apache-atlas-sqoop-hook-2.2.0-SNAPSHOT/hook/sqoop/atlas-sqoop-plugin-impl /usr/local/service/sqoop/lib/atlas-sqoop-plugin-impl
4.2.7 修改sqoop-site.xml&#xff0c;配置Sqoop Hook
如果这个文章对你有帮助&#xff0c;不要忘记 「在看」 「点赞」 「收藏」 三连啊喂&#xff01;
2022年全网首发|大数据专家级技能模型与学习指南(胜天半子篇)
互联网最坏的时代可能真的来了
我在B站读大学&#xff0c;大数据专业
我们在学习Flink的时候&#xff0c;到底在学习什么&#xff1f;
193篇文章暴揍Flink&#xff0c;这个合集你需要关注一下
Flink生产环境TOP难题与优化&#xff0c;阿里巴巴藏经阁YYDS
Flink CDC我吃定了耶稣也留不住他&#xff01;| Flink CDC线上问题小盘点
我们在学习Spark的时候&#xff0c;到底在学习什么&#xff1f;
在所有Spark模块中&#xff0c;我愿称SparkSQL为最强&#xff01;
硬刚Hive | 4万字基础调优面试小总结
数据治理方法论和实践小百科全书
标签体系下的用户画像建设小指南
4万字长文 | ClickHouse基础&实践&调优全视角解析
【面试&个人成长】2021年过半&#xff0c;社招和校招的经验之谈
大数据方向另一个十年开启 |《硬刚系列》第一版完结
我写过的关于成长/面试/职场进阶的文章
当我们在学习Hive的时候在学习什么&#xff1f;「硬刚Hive续集」