与 sqoop-import 相关的查询?

发布于 2024-12-22 11:32:40 字数 339 浏览 2 评论 0原文

场景:

我已将数据从 SQl Server 导入到 HDFS。数据以多个文件的形式存储在HDFS目录中:

零件-m-00000
零件-m-00001
零件-m-00002
部分-m-00003

问题:

我的问题是,在从 HDFS 目录读取存储的数据时,我们必须读取所有文件 (part-m-00000,01,02,03) 或只是 部分-m-00000。因为当我读取该数据时,我发现HDFS内部的数据有点缺失。 那么,这是发生了还是我错过了什么?

Scenario:

I have imported the data from SQl Server to HDFS. The data stored in HDFS directory in a multiple files as:

part-m-00000
part-m-00001
part-m-00002
part-m-00003

Question:

My question is that While reading this stored data from HDFS directory we have to read all file (part-m-00000,01,02,03) or just part-m-00000. Because when I read that data, I found that the data inside HDFS is little bit missing.
So, is it happens or something I missed out?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

金兰素衣 2024-12-29 11:32:40

您需要读取所有文件,而不仅仅是 00000。存在多个文件的原因是 sqoop 以映射缩减方式工作,将“导入”工作拆分为多个部分。每个部分的输出都放在一个单独的文件中。

RL

You need to read all the files, not just 00000. The reason there are multiple files is that sqoop works in a map-reduce fashion, splitting the "import" work to multiple parts. The output from each part is put in a separate file.

RL

伴我心暖 2024-12-29 11:32:40

Sqoop 正在运行导入,没有减速器。因此,映射器处理的部分文件没有合并。因此,您将看到部分文件,具体取决于您在 sqoop 命令中设置的映射器数量 --m4--num-4。因此,如果您提供 sqoop import --connect jdbc:mysql://localhost/db --username <> - 桌子<>--m1 那么它将只创建一个零件文件。

Sqoop is running the import with no reducers.As a result,there is no consolidation for the part files which were processed by the mappers.Hence you will see part files depending upon the number of mappers you have set in the sqoop command as --m4 or --num-4.So if you provide sqoop import --connect jdbc:mysql://localhost/db --username <>--table <>--m1 then it will create only one part file.

擦肩而过的背影 2024-12-29 11:32:40

如果您的结果大小很大,那么 Hive 会将结果存储在块中。如果您想使用 CLI 读取所有文件,请执行以下命令。

$ sudo cat part-m-*

它会给你最终的结果,没有任何遗漏的部分。

If your result size is huge, then Hive will store the result in chunks. And If you want to Read those all files using CLI, then execute below command.

$ sudo cat part-m-*

It will give you final result without any of missing part.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文