hive 导入hdfs数据_将数据加载或导入运行在基于HDFS的数据湖之上的Hive表中的另一种方法。

hive 导入hdfs数据

Preceding pen down the article, might want to stretch out appreciation to all the wellbeing teams beginning from cleaning/sterile group to Nurses, Doctors and other who are consistently battling to spare the mankind from continuous Covid-19 pandemic over the globe.

在下一篇文章之前,不妨向从清洁/无菌小组到护士,医生和其他一直在努力使人类免受全球Covid-19大流行的困扰的所有健康团队表示感谢。

The fundamental target of this article is to feature how we can load or import data into Hive tables without explicitly execute the “load” command. Basically, with this approach Data scientists can query or even visualize directly on various data visualization tool for quick investigation in a scenario when raw data is continuously ingested to HDFS based Data lake from the external sources on a consistent schedule. Otherwise, “load” command would be required to execute furthermore for stacking the processed data into Hive’s table. Here we are considering an existing environment with the following components either set up on the Cloud or on-premise.

本文的基本目标是介绍如何在不显式执行“ load”命令的情况下将数据加载或导入到Hive表中。 基本上,使用这种方法,当原始数据以一致的时间表从外部源连续摄取到基于HDFS的Data Lake时,数据科学家可以直接在各种数据可视化工具上进行查询甚至可视化,以进行快速调查。 否则,将需要“ load”命令来进一步执行,以将处理后的数据堆叠到Hive的表中。 在这里,我们正在考虑具有以下组件的现有环境,这些组件在云端或本地设置。

  • Multi-node Cluster where HDFS installed and configured. Hive running on top of HDFS with MySQL database as metastore.

    已安装和配置HDFS的多节点群集。 Hive在HDFS之上运行,并将MySQL数据库作为metastore。
  • Assuming raw data is getting dumped from multiple sources into HDFS Data lake landing zone by leveraging Kafka, Flume, customized data ingesting tool etc.

    假设利用Kafka,Flume,定制数据提取工具等将原始数据从多个来源转储到HDFS Data Lake登陆区。
  • From the landing zone, raw data moves to the refining zone in order to clean junk and subsequently into the processing zone where clean data gets processed. Here we are considering that the processed data stored in text files with CSV format.

    原始数据从着陆区移至精炼区,以清理垃圾,然后移至处理区,在此处理干净数据。 在这里,我们考虑将处理后的数据存储在CSV格式的文本文件中。

Hive input is directory-based which similar to many Hadoop tools. This means, input for an operation is taken as files in a given directory. Using HDFS command, let’s create a directory in the HDFS using “$ hdfs dfs -mkdir <<name of the folder>>. Same can be done using Hadoop administrative UI depending upon user’s HDFS ACL settings. Now move the data files from the processing zone into newly created HDFS folder. As an example, here we are considering simple order data that ingested into the data lake and eventually transformed to consolidated text files with CSV format after cleaning and filtering. Few lines of rows are as follows

Hive输入是基于目录的,类似于许多Hadoop工具。 这意味着,操作的输入将作为给定目录中的文件。 使用HDFS命令,让我们使用“ $ hdfs dfs -mkdir <<文件夹名称>>在HDFS中创建一个目录。 根据用户的HDFS ACL设置,可以使用Hadoop管理UI进行相同的操作。 现在,将数据文件从处理区域移到新创建的HDFS文件夹中。 例如,这里我们考虑的是简单的订单数据,这些数据被导入到数据湖中,并在清洗和过滤后最终转换为CSV格式的合并文本文件。 行的几行如下

Image for post

Next step is to create an external table in Hive by using the following command where the location is the path of HDFS directory that created on the previous step. here is the command we could use to create the external table using Hive CLI. The LOCATION statement in the command tells Hive where to find the input files.

下一步是使用以下命令在Hive中创建外部表,其中位置是在上一步中创建的HDFS目录的路径。 这是我们可以用来使用Hive CLI创建外部表的命令。 命令中的LOCATION语句告诉Hive在哪里找到输入文件。

Image for post

If the command worked, an OK will be printed and upon executing Hive query, Hive engine fetches the data internally from these input text files by leveraging processing engine Map Reducer or other like Spark, Tez etc. Ideally, Spark or Tez can be configured as a processing engine in hive-site.xml in order to improve the data processing speed for a huge volume of input files.

如果该命令有效,则将打印OK,并且在执行Hive查询时,Hive引擎可利用处理引擎Map Reducer或其他诸如Spark,Tez等从这些输入文本文件内部获取数据。理想情况下,Spark或Tez可配置为hive-site.xml中的处理引擎,以提高大量输入文件的数据处理速度。

Once the table creation is successful, we can cross-check it on “ metastore” schema in the MySQL database. To perform that, log in to MySQL CLI which might be running on a different node in the cluster and then connect to the “metastore” database as well as pulls records from “TBLS” table. This displays the created Hive table information.

一旦表创建成功,我们就可以在MySQL数据库的“ metastore”模式中对其进行交叉检查。 要执行此操作,请登录到可能正在集群中其他节点上运行MySQL CLI,然后连接到“元存储”数据库并从“ TBLS”表中提取记录。 这将显示创建的Hive表信息。

Image for post

The import can be verified through the Hive’s CLI by listing the first few rows in the table.

可以通过Hive的CLI列出表中的前几行来验证导入。

hive> Select * from OrderData;

蜂巢>从OrderData中选择*;

Additionally, “ analyze compute statistics “ command could be executed in Hive CLI to view the detail information of jobs that runs on that table.

另外,可以在Hive CLI中执行“ 分析计算统计信息 ”命令,以查看在该表上运行的作业的详细信息。

Image for post

The primary advantage with this approach is, data can be query, analyze etc within a minimum span of time without additionally perform explicit data loading operation. Also helps the Data scientists to check the quality of data before running their machine learning jobs on the data lake or cluster. You could read here how to install and configure Apache Hive on multi-node Hadoop cluster with MySQL as Metastore.

这种方法的主要优点是,可以在最短的时间范围内查询,分析数据,而无需另外执行显式的数据加载操作。 还可以帮助数据科学家在数据湖或集群上运行其机器学习作业之前检查数据质量。 您可以在此处阅读如何在以MySQL作为Metastore的多节点Hadoop集群上安装和配置Apache Hive。

Image for post

Written byGautam Goswami

Gautam Goswami 撰写

Image for post

Enthusiastic about learning and sharing knowledge on Big Data and related headways. Play at the intersection of innovation, music and workmanship.

热衷于学习和共享有关大数据和相关进展的知识。 在创新,音乐和Craft.io的交汇处演奏。

Originally published at https://dataview.in on August 4, 2020.

最初于 2020年8月4日 https://dataview.in 发布

翻译自: https://medium.com/@gautambangalore/an-alternative-way-of-loading-or-importing-data-into-hive-tables-running-on-top-of-hdfs-based-data-d3eee419eb46

hive 导入hdfs数据

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/388093.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Java性能优化

一、避免在循环条件中使用复杂表达式 在不做编译优化的情况下&#xff0c;在循环中&#xff0c;循环条件会被反复计算&#xff0c;如果不使用复杂表达式&#xff0c;而使循环条件值不变的话&#xff0c;程序将会运行的更快。 例子&#xff1a; import java.util.vector; class …

对Faster R-CNN的理解(1)

目标检测是一种基于目标几何和统计特征的图像分割&#xff0c;最新的进展一般是通过R-CNN&#xff08;基于区域的卷积神经网络&#xff09;来实现的&#xff0c;其中最重要的方法之一是Faster R-CNN。 1. 总体结构 Faster R-CNN的基本结构如下图所示&#xff0c;其基础是深度全…

大数据业务学习笔记_学习业务成为一名出色的数据科学家

大数据业务学习笔记意见 (Opinion) A lot of aspiring Data Scientists think what they need to become a Data Scientist is :许多有抱负的数据科学家认为&#xff0c;成为一名数据科学家需要具备以下条件&#xff1a; Coding 编码 Statistic 统计 Math 数学 Machine Learni…

postman 请求参数为数组及JsonObject

2019独角兽企业重金招聘Python工程师标准>>> 1. (1)数组的请求方式(post) https://blog.csdn.net/qq_21205435/article/details/81909184 (2)数组的请求方式&#xff08;get&#xff09; http://localhost:port/list?ages10,20,30 后端接收方式&#xff1a; PostMa…

领扣(LeetCode)对称二叉树 个人题解

给定一个二叉树&#xff0c;检查它是否是镜像对称的。 例如&#xff0c;二叉树 [1,2,2,3,4,4,3] 是对称的。 1/ \2 2/ \ / \ 3 4 4 3但是下面这个 [1,2,2,null,3,null,3] 则不是镜像对称的: 1/ \2 2\ \3 3说明: 如果你可以运用递归和迭代两种方法解决这个问题&#…

python 开发api_使用FastAPI和Python快速开发高性能API

python 开发apiIf you have read some of my previous Python articles, you know I’m a Flask fan. It is my go-to for building APIs in Python. However, recently I started to hear a lot about a new API framework for Python called FastAPI. After building some AP…

Purley平台Linpak测试,从踏坑开始一步步优化

Purley平台Linpak测试&#xff0c;从踏坑开始一步步优化 #记2017年11月第一次踏坑事件 测试平台配置&#xff1a; 6nodes CPU: Intel Gold 6132 2.6GHz 14C RAM: 8G *12 2666MHz NET: Infiband FDR OS: centos7.2 mpi: Intel-mpi hpl: xhpl.intel 开始踏第一坑 现象&#xff1a…

基于easyui开发Web版Activiti流程定制器详解(一)——目录结构

&#xfeff;&#xfeff;题外话&#xff08;可略过&#xff09;&#xff1a; 前一段时间&#xff08;要是没记错的话应该是3个月以前&#xff09;发布了一个更新版本&#xff0c;很多人说没有文档看着比较困难&#xff0c;所以打算拿点时间出来详细给大家讲解一下&#xff0c;…

HDOJ 2037:今年暑假不AC_大二写

AC代码&#xff1a; #include <iostream> #include <cstdio> #include <algorithm> #define Max 105 using namespace std;struct TimeList {int start;int end; }timelist[Max]; bool compare(TimeList a, TimeList b) {if(a.end b.end)return a.start &l…

基于easyui开发Web版Activiti流程定制器详解(二)——文件列表

&#xfeff;&#xfeff;上一篇我们介绍了目录结构&#xff0c;这篇给大家整理一个文件列表以及详细说明&#xff0c;方便大家查找文件。 由于设计器文件主要保存在wf/designer和js/designer目录下&#xff0c;所以主要针对这两个目录进行详细说明。 wf/designer目录文件详解…

杭电oj2047-2049、2051-2053、2056、2058

2047 阿牛的EOF牛肉串 1 #include<stdio.h>2 3 int main(){4 int n,i;5 _int64 s[51];6 while(~scanf("%d",&n)){7 s[1]3;s[2]8;8 for(i3;i<n;i){9 s[i] s[i-1]*2 s[i-2]*2; 10 } 11 print…

Power BI:M与DAX以及度量与计算列

When I embarked on my Power BI journey I was almost immediately slapped with an onslaught of foreign and perplexing terms that all seemed to do similar, but somehow different, things.当我开始Power BI之旅时&#xff0c;我几乎立刻受到了外国和困惑术语的冲击&am…

git 基本命令和操作

设置全局用户名密码 $ git config --global user.name runoob $ git config --global user.email testrunoob.comgit init:初始化仓库 创建新的 Git 仓库 git clone: 拷贝一个 Git 仓库到本地 : git clone [url]git add:将新增的文件添加到缓存 : git add test.htmlgit status …

基于easyui开发Web版Activiti流程定制器详解(三)——页面结构(上)

&#xfeff;&#xfeff;上一篇介绍了定制器相关的文件&#xff0c;这篇我们来看看整个定制器的界面部分&#xff0c;了解了页面结构有助于更好的理解定制器的实现&#xff0c;那么现在开始吧&#xff01; 首先&#xff0c;我们来看看整体的结构&#xff1a; 整体结构比较简单…

bzoj 4300 绝世好题 —— 思路

题目&#xff1a;https://www.lydsy.com/JudgeOnline/problem.php?id4300 记录一下 mx[j] 表示以第 j 位上是1的元素结尾的子序列长度最大值&#xff0c;转移即可。 代码如下&#xff1a; #include<iostream> #include<cstdio> #include<cstring> #include&…

基于easyui开发Web版Activiti流程定制器详解(四)——页面结构(下)

&#xfeff;&#xfeff;题外话&#xff1a; 这两天周末在家陪老婆和儿子没上来更新请大家见谅&#xff01;上一篇介绍了调色板和画布区的页面结构&#xff0c;这篇讲解一下属性区的结构也是定制器最重要的一个页面。 属性区整体页面结构如图&#xff1a; 在这个区域可以定义工…

梯度下降法优化目标函数_如何通过3个简单的步骤区分梯度下降目标函数

梯度下降法优化目标函数Nowadays we can learn about domains that were usually reserved for academic communities. From Artificial Intelligence to Quantum Physics, we can browse an enormous amount of information available on the Internet and benefit from it.如…

FFmpeg 是如何实现多态的?

2019独角兽企业重金招聘Python工程师标准>>> 前言 众所周知&#xff0c;FFmpeg 在解码的时候&#xff0c;无论输入文件是 MP4 文件还是 FLV 文件&#xff0c;或者其它文件格式&#xff0c;都能正确解封装、解码&#xff0c;而代码不需要针对不同的格式做出任何改变&…

基于easyui开发Web版Activiti流程定制器详解(五)——Draw2d详解(一)

&#xfeff;&#xfeff;背景&#xff1a; 小弟工作已有十年有余&#xff0c;期间接触了不少工作流产品&#xff0c;个人比较喜欢的还是JBPM&#xff0c;因为出自名门Jboss所以备受推崇&#xff0c;但是现在JBPM版本已经与自己当年使用的版本&#xff08;3.X&#xff09;大相径…

Asp.net MVC模型数据验证扩展ValidationAttribute

在Asp.Mvc项目中有自带的一套完整的数据验证功能&#xff0c;客户端可以用HtmlHelper工具类&#xff0c;服务端可以用ModelState进行验证。而他们都需要System.ComponentModel.DataAnnotations类库中的特性功能&#xff0c;通过在属性上方添加特性就可以达到验证前后端验证数据…