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?

Reply via email to