FAQ
Hi All,

I am just reading the book *Hadoop: The Definitive Guide *by Tom White,
there is an example for the *FileSystem* class in chapter 3,
example3-2:
------------------------------------------------------------------------------------------
public class FileSystemCat {

import java.io.InputStream;
import java.net.URI;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IOUtils;

public static void main(String[] args) throws Exception {
String uri = args[0];
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(URI.create(uri), conf);
InputStream in = null;
try {
in = fs.open(new Path(uri));
IOUtils.copyBytes(in, System.out, 4096, false);
} finally {
IOUtils.closeStream(in);
}
}
}
---------------------------------------------------------------------------------------------
I run the program as follows:
% export HADOOP_CLASSPATH=.
% hadoop FileSystem.Cat
hdfs://localhost/user/hadoop-user/input/mapred-site.xml

and then, what i got was as fllows:

ipc.Client: Retrying connect to server: localhost/127.0.0.1:8020. Already
tried 0 time(s).
11/05/22 20:45:53 INFO ipc.Client: Retrying connect to server: localhost/
127.0.0.1:8020. Already tried 1 time(s).
11/05/22 20:45:53 INFO ipc.Client: Retrying connect to server: localhost/
127.0.0.1:8020. Already tried 1 time(s).
11/05/22 20:45:54 INFO ipc.Client: Retrying connect to server: localhost/
127.0.0.1:8020. Already tried 2 time(s).
....................................

can anyone help?

Search Discussions

  • Ayon Sinha at May 22, 2011 at 4:43 pm
    Is yours hdfs running?

    -Ayon
    See My Photos on Flickr
    Also check out my Blog for answers to commonly asked questions.



    ________________________________
    From: Yang Xiaoliang <yangxiaoliang2006@gmail.com>
    To: hdfs-user@hadoop.apache.org
    Sent: Sunday, May 22, 2011 7:23 AM
    Subject: FileSystemCat ipc.Client: Retrying connect to server:

    Hi All,

    I am just reading the book *Hadoop: The Definitive Guide *by Tom White,
    there is an example for the *FileSystem* class in chapter 3,
    example3-2:
    ------------------------------------------------------------------------------------------
    public class FileSystemCat {

    import java.io.InputStream;
    import java.net.URI;

    import org.apache.hadoop.conf.Configuration;
    import org.apache.hadoop.fs.FileSystem;
    import org.apache.hadoop.fs.Path;
    import org.apache.hadoop.io.IOUtils;

    public static void main(String[] args) throws Exception {
    String uri = args[0];
    Configuration conf = new Configuration();
    FileSystem fs = FileSystem.get(URI.create(uri), conf);
    InputStream in = null;
    try {
    in = fs.open(new Path(uri));
    IOUtils.copyBytes(in, System.out, 4096, false);
    } finally {
    IOUtils.closeStream(in);
    }
    }
    }
    ---------------------------------------------------------------------------------------------
    I run the program as follows:
    % export HADOOP_CLASSPATH=.
    % hadoop FileSystem.Cat
    hdfs://localhost/user/hadoop-user/input/mapred-site.xml

    and then, what i got was as fllows:

    ipc.Client: Retrying connect to server: localhost/127.0.0.1:8020. Already
    tried 0 time(s).
    11/05/22 20:45:53 INFO ipc.Client: Retrying connect to server: localhost/
    127.0.0.1:8020. Already tried 1 time(s).
    11/05/22 20:45:53 INFO ipc.Client: Retrying connect to server: localhost/
    127.0.0.1:8020. Already tried 1 time(s).
    11/05/22 20:45:54 INFO ipc.Client: Retrying connect to server: localhost/
    127.0.0.1:8020. Already tried 2 time(s).
    ....................................

    can anyone help?
  • Yang Xiaoliang at May 22, 2011 at 4:52 pm
    yes , I sure of that.

    2011/5/23, Ayon Sinha <ayonsinha@yahoo.com>:
    Is yours hdfs running?

    -Ayon
    See My Photos on Flickr
    Also check out my Blog for answers to commonly asked questions.



    ________________________________
    From: Yang Xiaoliang <yangxiaoliang2006@gmail.com>
    To: hdfs-user@hadoop.apache.org
    Sent: Sunday, May 22, 2011 7:23 AM
    Subject: FileSystemCat ipc.Client: Retrying connect to server:

    Hi All,

    I am just reading the book *Hadoop: The Definitive Guide *by Tom White,
    there is an example for the *FileSystem* class in chapter 3,
    example3-2:
    ------------------------------------------------------------------------------------------
    public class FileSystemCat {

    import java.io.InputStream;
    import java.net.URI;

    import org.apache.hadoop.conf.Configuration;
    import org.apache.hadoop.fs.FileSystem;
    import org.apache.hadoop.fs.Path;
    import org.apache.hadoop.io.IOUtils;

    public static void main(String[] args) throws Exception {
    String uri = args[0];
    Configuration conf = new Configuration();
    FileSystem fs = FileSystem.get(URI.create(uri), conf);
    InputStream in = null;
    try {
    in = fs.open(new Path(uri));
    IOUtils.copyBytes(in, System.out, 4096, false);
    } finally {
    IOUtils.closeStream(in);
    }
    }
    }
    ---------------------------------------------------------------------------------------------
    I run the program as follows:
    % export HADOOP_CLASSPATH=.
    % hadoop FileSystem.Cat
    hdfs://localhost/user/hadoop-user/input/mapred-site.xml

    and then, what i got was as fllows:

    ipc.Client: Retrying connect to server: localhost/127.0.0.1:8020. Already
    tried 0 time(s).
    11/05/22 20:45:53 INFO ipc.Client: Retrying connect to server: localhost/
    127.0.0.1:8020. Already tried 1 time(s).
    11/05/22 20:45:53 INFO ipc.Client: Retrying connect to server: localhost/
    127.0.0.1:8020. Already tried 1 time(s).
    11/05/22 20:45:54 INFO ipc.Client: Retrying connect to server: localhost/
    127.0.0.1:8020. Already tried 2 time(s).
    ....................................

    can anyone help?
  • Ayon Sinha at May 22, 2011 at 5:01 pm
    Are you able to run the hdfs filesystem shell commands? Can you try adding the port number of the namenode in the URI hdfs://localhost/user/hadoop-user/input/mapred-site.xml ?

    -Ayon
    See My Photos on Flickr
    Also check out my Blog for answers to commonly asked questions.



    ________________________________
    From: Yang Xiaoliang <yangxiaoliang2006@gmail.com>
    To: hdfs-user@hadoop.apache.org; Ayon Sinha <ayonsinha@yahoo.com>
    Sent: Sunday, May 22, 2011 9:51 AM
    Subject: Re: FileSystemCat ipc.Client: Retrying connect to server:

    yes , I sure of that.

    2011/5/23, Ayon Sinha <ayonsinha@yahoo.com>:
    Is yours hdfs running?

    -Ayon
    See My Photos on Flickr
    Also check out my Blog for answers to commonly asked questions.



    ________________________________
    From: Yang Xiaoliang <yangxiaoliang2006@gmail.com>
    To: hdfs-user@hadoop.apache.org
    Sent: Sunday, May 22, 2011 7:23 AM
    Subject: FileSystemCat ipc.Client: Retrying connect to server:

    Hi All,

    I am just reading the book *Hadoop: The Definitive Guide *by Tom White,
    there is an example for the *FileSystem* class in chapter 3,
    example3-2:
    ------------------------------------------------------------------------------------------
    public class FileSystemCat {

    import java.io.InputStream;
    import java.net.URI;

    import org.apache.hadoop.conf.Configuration;
    import org.apache.hadoop.fs.FileSystem;
    import org.apache.hadoop.fs.Path;
    import org.apache.hadoop.io.IOUtils;

    public static void main(String[] args) throws Exception {
    String uri = args[0];
    Configuration conf = new Configuration();
    FileSystem fs = FileSystem.get(URI.create(uri), conf);
    InputStream in = null;
    try {
    in = fs.open(new Path(uri));
    IOUtils.copyBytes(in, System.out, 4096, false);
    } finally {
    IOUtils.closeStream(in);
    }
    }
    }
    ---------------------------------------------------------------------------------------------
    I run the program as follows:
    % export HADOOP_CLASSPATH=.
    % hadoop FileSystem.Cat
    hdfs://localhost/user/hadoop-user/input/mapred-site.xml

    and then, what i got was as fllows:

    ipc.Client: Retrying connect to server: localhost/127.0.0.1:8020. Already
    tried 0 time(s).
    11/05/22 20:45:53 INFO ipc.Client: Retrying connect to server: localhost/
    127.0.0.1:8020. Already tried 1 time(s).
    11/05/22 20:45:53 INFO ipc.Client: Retrying connect to server: localhost/
    127.0.0.1:8020. Already tried 1 time(s).
    11/05/22 20:45:54 INFO ipc.Client: Retrying connect to server: localhost/
    127.0.0.1:8020. Already tried 2 time(s).
    ....................................

    can anyone help?
  • Yang Xiaoliang at May 22, 2011 at 5:36 pm
    I followed your advice to add the port number as follows:
    % hadoop FileSystem.Cat
    hdfs://localhost:9000/user/hadoop-user/input/mapred-site.xml

    and it runs correctly :-)

    Thank you very much!

    2011/5/23, Ayon Sinha <ayonsinha@yahoo.com>:
    Are you able to run the hdfs filesystem shell commands? Can you try adding
    the port number of the namenode in the
    URI hdfs://localhost/user/hadoop-user/input/mapred-site.xml ?

    -Ayon
    See My Photos on Flickr
    Also check out my Blog for answers to commonly asked questions.



    ________________________________
    From: Yang Xiaoliang <yangxiaoliang2006@gmail.com>
    To: hdfs-user@hadoop.apache.org; Ayon Sinha <ayonsinha@yahoo.com>
    Sent: Sunday, May 22, 2011 9:51 AM
    Subject: Re: FileSystemCat ipc.Client: Retrying connect to server:

    yes , I sure of that.

    2011/5/23, Ayon Sinha <ayonsinha@yahoo.com>:
    Is yours hdfs running?

    -Ayon
    See My Photos on Flickr
    Also check out my Blog for answers to commonly asked questions.



    ________________________________
    From: Yang Xiaoliang <yangxiaoliang2006@gmail.com>
    To: hdfs-user@hadoop.apache.org
    Sent: Sunday, May 22, 2011 7:23 AM
    Subject: FileSystemCat ipc.Client: Retrying connect to server:

    Hi All,

    I am just reading the book *Hadoop: The Definitive Guide *by Tom White,
    there is an example for the *FileSystem* class in chapter 3,
    example3-2:
    ------------------------------------------------------------------------------------------
    public class FileSystemCat {

    import java.io.InputStream;
    import java.net.URI;

    import org.apache.hadoop.conf.Configuration;
    import org.apache.hadoop.fs.FileSystem;
    import org.apache.hadoop.fs.Path;
    import org.apache.hadoop.io.IOUtils;

    public static void main(String[] args) throws Exception {
    String uri = args[0];
    Configuration conf = new Configuration();
    FileSystem fs = FileSystem.get(URI.create(uri), conf);
    InputStream in = null;
    try {
    in = fs.open(new Path(uri));
    IOUtils.copyBytes(in, System.out, 4096, false);
    } finally {
    IOUtils.closeStream(in);
    }
    }
    }
    ---------------------------------------------------------------------------------------------
    I run the program as follows:
    % export HADOOP_CLASSPATH=.
    % hadoop FileSystem.Cat
    hdfs://localhost/user/hadoop-user/input/mapred-site.xml

    and then, what i got was as fllows:

    ipc.Client: Retrying connect to server: localhost/127.0.0.1:8020. Already
    tried 0 time(s).
    11/05/22 20:45:53 INFO ipc.Client: Retrying connect to server: localhost/
    127.0.0.1:8020. Already tried 1 time(s).
    11/05/22 20:45:53 INFO ipc.Client: Retrying connect to server: localhost/
    127.0.0.1:8020. Already tried 1 time(s).
    11/05/22 20:45:54 INFO ipc.Client: Retrying connect to server: localhost/
    127.0.0.1:8020. Already tried 2 time(s).
    ....................................

    can anyone help?

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouphdfs-user @
categorieshadoop
postedMay 22, '11 at 2:24p
activeMay 22, '11 at 5:36p
posts5
users2
websitehadoop.apache.org...
irc#hadoop

2 users in discussion

Yang Xiaoliang: 3 posts Ayon Sinha: 2 posts

People

Translate

site design / logo © 2022 Grokbase