You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by Lei xu <ed...@gmail.com> on 2009/01/30 22:52:18 UTC

Connection refused when send http request to a datanode started by MiniDFSCluster

Hi, all

When I wrote test cases to test a http request, I started a
MiniDFSCluster and create some files:

   cluster = new MiniDFSCluster(conf, 3, true, null);
      cluster.waitActive();
      String fileName = "/testStatus.txt";
      Path filePath = new Path(fileName);
      FileSystem fs = cluster.getFileSystem();

      long fileLen = 3 * 1024 * 1024; // 3 MB
      DFSTestUtil.createFile(fs, filePath, fileLen, (short)1, 1L);
      DFSTestUtil.waitReplication(fs, filePath, (short)1);

Then I send http request to one datanode , there was a exception raised:

2009-01-30 15:20:32,212 INFO  namenode.NameNode
(NamenodeFsck.java:status(190)) - Status of
http://<address>:50769/verify?status=1

2009-01-30 15:20:32,214 WARN  namenode.NameNode
(NamenodeFsck.java:status(230)) - Status of fsck FAILED
java.net.ConnectException: Connection refused
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
	at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
	at java.net.Socket.connect(Socket.java:519)
	at java.net.Socket.connect(Socket.java:469)
	at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
	at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
	at sun.net.www.http.HttpClient.New(HttpClient.java:306)
	at sun.net.www.http.HttpClient.New(HttpClient.java:323)
	at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:788)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:729)
	at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:654)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:977)
	at org.apache.hadoop.hdfs.server.namenode.NamenodeFsck.status(NamenodeFsck.java:203)
	at org.apache.hadoop.hdfs.server.namenode.FsckServlet.doGet(FsckServlet.java:63)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417)
	at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:324)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)

I though it maybe the Info server of DataNode did not open yet. How
can I fix it? Thanks!

-- Lei