我已经设置了amazon ec2实例并安装了hadoop-1.0.4单节点,启动了所有hadoop组件,并且工作正常。
我通过使用hadoop命令上传文件来测试hadoop集群并且工作正常。
当我通过java代码访问hadoop集群时,我遇到了异常
连接异常失败:java.net.ConnectException:连接被拒绝:没有进一步的信息
/ etc / hosts文件
的
的127.0.0.1 localhost
127.0.0.1 ec2-x.x.x.x.compute-1.amazonaws.com ip-x.x.x.x.ec2.internal
的
芯-site.xml中
的
的<property>
<name>fs.default.name</name>
<value>hdfs://ec2-x.x.x.x.compute-1.amazonaws.com:54310</value>
</property>
的 你能帮我解决这个问题吗?
完整打印堆栈跟踪
: Call to ec2-X.X.X.X.compute-1.amazonaws.com/X.X.X.X:54310 failed on connection exception: java.net.ConnectException: Connection refused: no further information
at org.apache.hadoop.ipc.Client.wrapException(
Client.java:1099)
at org.apache.hadoop.ipc.Client.call(
Client.java:1075)
at org.apache.hadoop.ipc.RPC$Invoker.invoke(
RPC.java:225)
at $Proxy7.getProtocolVersion(Unknown Source)
at org.apache.hadoop.ipc.RPC.getProxy(
RPC.java:396)
at org.apache.hadoop.ipc.RPC.getProxy(
RPC.java:379)
at org.apache.hadoop.hdfs.DFSClient.createRPCNamenode(
DFSClient.java:119)
at org.apache.hadoop.hdfs.DFSClient.<init>(
DFSClient.java:238)
at org.apache.hadoop.hdfs.DFSClient.<init>(
DFSClient.java:203)
at org.apache.hadoop.hdfs.DistributedFileSystem.initialize(
DistributedFileSystem.java:89)
at org.apache.hadoop.fs.FileSystem.createFileSystem(
FileSystem.java:1386)
at org.apache.hadoop.fs.FileSystem.access$200(
FileSystem.java:66)
at org.apache.hadoop.fs.FileSystem$Cache.get(
FileSystem.java:1404)
at org.apache.hadoop.fs.FileSystem.get(
FileSystem.java:254)
at org.apache.hadoop.fs.FileSystem.get(
FileSystem.java:123)
at org.bigpeep.upload.custom.SolrIndexMapReduce.run(
SolrIndexMapReduce.java:45)
at org.apache.hadoop.util.ToolRunner.run(
ToolRunner.java:65)
at org.bigpeep.upload.dal.FileDaoImpl.indexDoc(
FileDaoImpl.java:370)
at org.bigpeep.upload.service.FileServiceImpl.indexDocument(
FileServiceImpl.java:96)
at org.bigpeep.upload.service.FileServiceImplTest.testuploadFile(
FileServiceImplTest.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(
Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(
Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(
FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(
ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(
FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(
InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(
RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(
RunAfters.java:31)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(
BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(
BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(
ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(
ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(
ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(
ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(
ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(
ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(
JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(
TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(
RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(
RemoteTestRunner.java:197)
Caused by:
java.net.ConnectException: Connection refused: no further information
at sun.nio.ch.SocketChannelImpl.checkConnect(
Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(
SocketChannelImpl.java:574)
at org.apache.hadoop.net.SocketIOWithTimeout.connect(
SocketIOWithTimeout.java:206)
at org.apache.hadoop.net.NetUtils.connect(
NetUtils.java:489)
at org.apache.hadoop.ipc.Client$Connection.setupConnection(
Client.java:434)
at org.apache.hadoop.ipc.Client$Connection.setupIOstreams(
Client.java:560)
at org.apache.hadoop.ipc.Client$Connection.access$2000(
Client.java:184)
at org.apache.hadoop.ipc.Client.getConnection(
Client.java:1206)
at org.apache.hadoop.ipc.Client.call(
Client.java:1050)