- Hadoop Real-World Solutions Cookbook(Second Edition)
- Tanmay Deshpande
- 218字
- 2021-07-09 20:02:50
Exporting HDFS data to a local machine
In this recipe, we are going to export/copy data from HDFS to the local machine.
Getting ready
To perform this recipe, you should already have a running Hadoop cluster.
How to do it...
Performing this recipe is as simple as copying data from one folder to the other. There are a couple of ways in which you can export data from HDFS to the local machine.
- Using the
copyToLocal
command, you'll get this code:hadoop fs -copyToLocal /mydir1/LICENSE.txt /home/ubuntu
- Using the
get
command, you'll get this code:hadoop fs -get/mydir1/LICENSE.txt /home/ubuntu
How it works...
When you use HDFS copyToLocal
or the get
command, the following things occur:
- First of all, the client contacts
NameNode
because it needs a specific file in HDFS. NameNode
then checks whether such a file exists in itsFSImage
. If the file is not present, the error code is returned to the client.- If the file exists,
NameNode
checks the metadata for blocks and replica placements inDataNodes
. NameNode
then directly pointsDataNode
from where the blocks would be given to the client one by one. The data is directly copied fromDataNode
to the client machine. and it never goes throughNameNode
to avoid bottlenecks.- Thus, the file is exported to the local machine from HDFS.
推薦閱讀
- 亮劍.NET:.NET深入體驗與實戰精要
- 大學計算機信息技術導論
- Div+CSS 3.0網頁布局案例精粹
- 空間機器人遙操作系統及控制
- 條碼技術及應用
- 樂高創意機器人教程(中級 下冊 10~16歲) (青少年iCAN+創新創意實踐指導叢書)
- Visual Basic從初學到精通
- 大數據處理平臺
- Photoshop CS3圖層、通道、蒙版深度剖析寶典
- Visual C++編程全能詞典
- 智能生產線的重構方法
- Linux Shell編程從初學到精通
- Photoshop CS4數碼照片處理入門、進階與提高
- Effective Business Intelligence with QuickSight
- Getting Started with Tableau 2019.2