我是Hadoop
的新用戶?想知道Hadoop
中InputFormat
有多少種?TextInputFormat
?有沒有一個InputFormat
,我可以用它來通過http請求讀取文件到遠程數據服務器?Hadoop中有多少種InputFormat類型?
謝謝:)
我是Hadoop
的新用戶?想知道Hadoop
中InputFormat
有多少種?TextInputFormat
?有沒有一個InputFormat
,我可以用它來通過http請求讀取文件到遠程數據服務器?Hadoop中有多少種InputFormat類型?
謝謝:)
你的第一個問題 - 在Hadoop中如何InputFormat的種類很多,有如的TextInputFormat?
TextInputFormat
- 前定界符是鍵,其餘的是值FixedLengthInputFormat
第一值 - - 每行會被當作值KeyValueTextInputFormat
每個固定長度值被認爲是值NLineInputFormat
- N的行數被認爲是一個值/記錄SequenceFileInputFormat
- 對於二進制還有DBInputFormat
從數據庫中讀取
第二個問題 - 沒有輸入格式來通過http請求讀取文件。
有許多classes
實施InputFormat
CombineFileInputFormat, CombineSequenceFileInputFormat,
CombineTextInputFormat, CompositeInputFormat, DBInputFormat,
FileInputFormat, FixedLengthInputFormat, KeyValueTextInputFormat,
MultiFileInputFormat, NLineInputFormat, Parser.Node,
SequenceFileAsBinaryInputFormat, SequenceFileAsTextInputFormat,
SequenceFileInputFilter, SequenceFileInputFormat, TextInputFormat
對何時使用哪種類型的Inputformat
看看這個article。
這些中,最常用的是formats
:
FileInputFormat
:所有基於文件的InputFormatsKeyValueTextInputFormat
基類:純文本文件的InputFormat。文件被分解成行。換行符或回車符用於表示行結束。每行按分隔符字節分爲鍵和值部分。如果不存在這樣的字節,則該鍵將是整行,並且值將是空的。TextInputFormat
:純文本文件的InputFormat。文件被分解成行。換行符或回車符都用於表示行結束。鍵是文件中的位置,值是文本行。NLineInputFormat
:將輸入的N行分割爲一個分割的NLineInputFormat。在許多「愉快」並行應用程序中,每個進程/映射程序處理相同的輸入文件,但計算由不同的參數控制。SequenceFileInputFormat
:SequenceFile的InputFormat。關於第二個查詢,首先從遠程servers
獲取文件,並根據文件中的內容使用合適的InputFileFormat
。 Hadoop
最適合數據局部性。
第二個問題呢?有沒有解決方案? – Trams