如何确定hdfs(azure blob存储)上文件的文件编码?

r6l8ljro  于 2021-06-02  发布在  Hadoop
关注(0)|答案(2)|浏览(473)

我在hdfs上有一堆100gb的文件,混合了文件编码(不幸的是在azureblob存储中)。如何确定每个文件的文件编码?一些dfs命令行命令将是理想的。谢谢。

7lrncoxx

7lrncoxx1#

我通过将blob存储中每个文件的开头连接到本地缓冲区,然后应用 file unix实用程序。以下是单个文件的命令:

hdfs dfs -cat wasb://container@account.blob.core.windows.net/path/to/file | head -n 10 > buffer; file -i buffer

这会让你觉得:

buffer: text/plain; charset=us-ascii
wtlkbnrh

wtlkbnrh2#

你可以试试https://azure.microsoft.com/en-us/documentation/articles/xplat-cli-install/
命令 azure storage blob list 以及 azure storage blob show 将返回所有可用的blob属性,包括contenttype、contentlength和元数据。
如果这个信息不包含你想要的-文件编码,我认为你需要定义/设置你自己的 metadata 就像 file-encoding 对于每个文件。然后可以通过cli工具将其检索回来。

相关问题