0
在Hadoop中,我們可以獲取地圖輸入文件路徑爲;從MapReduce獲取Azure Blob路徑
Path pt = new Path(((FileSplit) context.getInputSplit()).getPath().toString());
但我找不到任何文檔如何從Azure Blob存儲帳戶實現此目的。有沒有辦法從mapreduce程序中獲取Azure Blob路徑?
在Hadoop中,我們可以獲取地圖輸入文件路徑爲;從MapReduce獲取Azure Blob路徑
Path pt = new Path(((FileSplit) context.getInputSplit()).getPath().toString());
但我找不到任何文檔如何從Azure Blob存儲帳戶實現此目的。有沒有辦法從mapreduce程序中獲取Azure Blob路徑?
如果您想要獲取當前mapper或reducer進程的輸入文件路徑,您的代碼是通過MapContext
/ReduceContext
獲取路徑的唯一方法。
如果不是,要獲取core-site.xml
文件中定義的容器的文件列表,請嘗試下面的代碼。
Configuration configuration = new Configuration();
FileSystem hdfs = FileSystem.get(configuration);
Path home = hdfs.getHomeDirectory();
FileStatus[] files = hdfs.listStatus(home);
希望它有幫助。