hadoop-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shashwat shriparv <dwivedishash...@gmail.com>
Subject Re: Client and NN communication in Hadoop
Date Thu, 27 Feb 2014 05:02:57 GMT
The application that try to write the file, for example the binary "hadoop"
found in the bin dir of hadoop is a hadoop client, whoever wants to read or
write from to hadoop is a client, you can also write hadoop client using
java apis which hadoop provide.

like following is an example of hadoop client which tries to read file from
hadoop

import java.io.*;
import java.util.*;
import java.net.*;
import org.apache.hadoop.fs.*;
import org.apache.hadoop.conf.*;
import org.apache.hadoop.io.*;
import org.apache.hadoop.mapred.*;
import org.apache.hadoop.util.*;

public class Cat{
        public static void main (String [] args) throws Exception{
                try{
                        Path pt=new
Path("hdfs://shashwat:9000/home/shriparv/fileonhdfstoread.txt");
                        FileSystem filesysObject = FileSystem.get(new
Configuration());
                        BufferedReader bufferReaderObject=new
BufferedReader(new InputStreamReader(filesysObject.open(pt)));
                        String line;
                        line=bufferReaderObject.readLine();
                        while (line != null){
                                System.out.println(line);
                                line=bufferReaderObject.readLine();
                        }
                }catch(Exception e){
                }
        }
}

Hope this clear some of your doubts


* Warm Regards_**∞_*
* Shashwat Shriparv*
 [image: http://www.linkedin.com/pub/shashwat-shriparv/19/214/2a9]<http://www.linkedin.com/pub/shashwat-shriparv/19/214/2a9>[image:
https://twitter.com/shriparv] <https://twitter.com/shriparv>[image:
https://www.facebook.com/shriparv] <https://www.facebook.com/shriparv>[image:
http://google.com/+ShashwatShriparv]
<http://google.com/+ShashwatShriparv>[image:
http://www.youtube.com/user/sShriparv/videos]<http://www.youtube.com/user/sShriparv/videos>[image:
http://profile.yahoo.com/SWXSTW3DVSDTF2HHSRM47AV6DI/] <shriparv@yahoo.com>



On Thu, Feb 27, 2014 at 9:53 AM, navaz <navaz.enc@gmail.com> wrote:

> Hi
>
>
>
> I have a Hadoop cluster running with 3 slaves and 1 Master. Slaves are
> Datanodes and running Tasktarckers. Namenode is running jobtracker and
> secondary namenode. I am running sample mapreduce after loading a file into
> HDFS.
>
>
>
> According to Hadoop architecture ,before writing a file into HDFS ,
>  client will contact the Namenode and get the location details of DNs and
> then client directly write the file into DN.  What is this client ? is it
> an application running on Namenode ? Is user and client both are different
> ? How can I see the messages between client and datanodes?
>
>
>
> Appreciate your response.
>
>
>
>
>
> Thanks & Regards
>
>
>
> Abdul Navaz
>
> Graduate Student
>
> University of Houston Main Campus,Texas
>
> Mob: (281) 685-0388
>
>
>

Mime
View raw message