[英]How to open HDFS output file using gedit?
I have installed and executed an mapreduce program successfully in my system(Ubuntu 14.04). 我已经在系统中成功安装并执行了mapreduce程序(Ubuntu 14.04)。
I can see the output file as, 我可以看到输出文件为
hadoopuser@arul-PC:/usr/local/hadoop$ bin/hadoop dfs -ls /user/hadoopuser/MapReduceSample-output
Found 3 items
-rw-r--r-- 1 hadoopuser supergroup 0 2014-07-09 16:10 /user/hadoopuser/MapReduceSample-output/_SUCCESS
drwxr-xr-x - hadoopuser supergroup 0 2014-07-09 16:10 /user/hadoopuser/MapReduceSample-output/_logs
-rw-r--r-- 1 hadoopuser supergroup 880838 2014-07-09 16:10 /user/hadoopuser/MapReduceSample-output/part-00000
And I can open it on terminal using following command, 我可以使用以下命令在终端上打开它,
hadoopuser@arul-PC:/usr/local/hadoop$ bin/hadoop dfs -cat /user/hadoopuser/MapReduceSample-output/part-00000
I can see the output file on terminal, but I can't see the full result because my output has large amount of lines. 我可以在终端上看到输出文件,但是由于我的输出有很多行,所以看不到完整的结果。
So I want to open it on gedit
or nano
. 所以我想在gedit
或nano
上打开它。
Need Solution. 需要解决方案。
您还可以使用getmerge
将HDFS文件复制到本地系统。
hadoopuser@arul-PC:/usr/local/hadoop$ bin/hadoop dfs -getmerge /user/hadoopuser/MapReduceSample-output/part-00000 /home/arul/MROutput
hadoop dfs -getmerge /path/to/HDFS /path/to/save
instead of looking for plugin. 而不是寻找插件。 You can add jar files from $HADOOP_INSTALL/bin in eclipse and compiler issues must be gone. 您可以在Eclipse中从$ HADOOP_INSTALL / bin添加jar文件,并且必须解决编译器问题。
You can't access HDFS file from local machine(system user), so that you can't open HDFS file using gedit
. 您无法从本地计算机(系统用户)访问HDFS文件,因此无法使用gedit
打开HDFS文件。
To open in gedit
you have to copy to local machine. 要在gedit
打开,您必须复制到本地计算机。
To do that, open terminal( Ctrl + Alt + T ) and use copyToLocal
a Hadoop Shell Command to copy the output file into local machine. 为此,请打开终端( Ctrl + Alt + T ),然后使用Hadoop Shell命令 copyToLocal
将输出文件复制到本地计算机中。
Do the following, 请执行下列操作,
hadoopuser@arul-PC:/usr/local/hadoop$ sudo bin/hadoop dfs -copyToLocal /user/hadoopuser/MapReduceSample-output/part-00000 /home/arul/Downloads/
Now you can open the output file using gedit
as follows, 现在,您可以使用gedit
打开输出文件,如下所示:
$ sudo gedit /home/arul/Downloads/part-00000
Note : 注意 :
hadoopuser
. 我的HDFS用户名是hadoopuser
。 fs -mv
allow to move different HDFS location. Hadoop Shell命令 fs -mv
允许移动不同的HDFS位置。 Update ( An another option to do the same from Y-Prithvi 's post ) 更新 ( 从Y-Prithvi的帖子执行此操作的另一个选项 )
you can also use getmerge to copy HDFS file to local system. 您还可以使用getmerge将HDFS文件复制到本地系统。
hadoopuser@arul-PC:/usr/local/hadoop$ bin/hadoop dfs -getmerge /user/hadoopuser/MapReduceSample-output/part-00000 /home/arul/MROutput
hadoop dfs -getmerge /path/to/HDFS /path/to/save
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.