2

HDFS コマンドを使用して、hdfs ファイルのテキスト コンテンツを別のファイル システムにコピーする方法はありますか。

 hadoop fs -text /user/dir1/abc.txt

-cat または任意の方法を使用して、-text の出力を別のファイルに出力できますか?:

 hadoop fs -cat /user/deepak/dir1/abc.txt 
4

4 に答える 4

2

ドキュメントに書かれているように、でhadoop fs -cpファイルをコピーするために使用できますhdfs。からローカル ファイル システムにhadoop fs -copyToLocalファイルをコピーするために使用できます。ファイルをあるファイルから別のhdfsファイルにコピーする場合は、 DistCp ツールを使用します。hdfs

于 2014-08-22T07:46:34.720 に答える
0

一般的なコマンドラインのヒントとして、|別のプログラムまたは>ファイル>>に使用できます。

# Will output to standard output (console) and the file /my/local/file
# this will overwrite the file, use ... tee -a ... to append
hdfs dfs -text /path/to/file | tee /my/local/file

# Will redirect output to some other command
hdfs dfs -text /path/to/file | some-other-command

# Will overwrite /my/local/file
hdfs dfs -text /path/to/file > /my/local/file

# Will append to /my/local/file
hdfs dfs -text /path/to/file >> /my/local/file
于 2014-08-22T09:25:51.910 に答える
0

以下を使用できます:

  1. copyToLocal
    hadoop dfs -copyToLocal /HDFS/file /user/deepak/dir1/abc.txt
  2. getmerge
    hadoop dfs -getmerge /HDFS/file /user/deepak/dir1/abc.txt
  3. 得る
    hadoop dfs -get /HDFS/file /user/deepak/dir1/abc.txt
于 2014-08-22T10:14:16.783 に答える