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.pswp.cn/news/388093.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/388093.shtml
英文地址,請注明出處:http://en.pswp.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;通過在屬性上方添加特性就可以達到驗證前后端驗證數據…