在Hadoop部署成功后,运行Hadoop cookbook chapter2的例子:URLCat,出现以下错误:
[cloud@hdn01 hadoop-1.2.1]$ bin/hadoop URLCat hdfs://hdn01:9000/user/cloud/in/file1.txt
Warning: $HADOOP_HOME is deprecated.13/12/09 16:13:35 INFO ipc.Client: Retrying connect to server: hdn01/10.1.1.10:9000. Already tried 0 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
13/12/09 16:13:36 INFO ipc.Client: Retrying connect to server: hdn01/10.1.1.10:9000. Already tried 1 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
13/12/09 16:13:37 INFO ipc.Client: Retrying connect to server: hdn01/10.1.1.10:9000. Already tried 2 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
13/12/09 16:13:38 INFO ipc.Client: Retrying connect to server: hdn01/10.1.1.10:9000. Already tried 3 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
13/12/09 16:13:39 INFO ipc.Client: Retrying connect to server: hdn01/10.1.1.10:9000. Already tried 4 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
13/12/09 16:13:40 INFO ipc.Client: Retrying connect to server: hdn01/10.1.1.10:9000. Already tried 5 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
13/12/09 16:13:41 INFO ipc.Client: Retrying connect to server: hdn01/10.1.1.10:9000. Already tried 6 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
13/12/09 16:13:42 INFO ipc.Client: Retrying connect to server: hdn01/10.1.1.10:9000. Already tried 7 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
13/12/09 16:13:43 INFO ipc.Client: Retrying connect to server: hdn01/10.1.1.10:9000. Already tried 8 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
13/12/09 16:13:44 INFO ipc.Client: Retrying connect to server: hdn01/10.1.1.10:9000. Already tried 9 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1 SECONDS)
Exception in thread "main" java.net.ConnectException: Call to hdn01/10.1.1.10:9000 failed on connection exception: java.net.ConnectException: Connection refused
at org.apache.hadoop.ipc.Client.wrapException(Client.java:1142)
at org.apache.hadoop.ipc.Client.call(Client.java:1118)
at org.apache.hadoop.ipc.RPC$Invoker.invoke(RPC.java:229)
at com.sun.proxy.$Proxy1.getProtocolVersion(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:85)
at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:62)
at com.sun.proxy.$Proxy1.getProtocolVersion(Unknown Source)
at org.apache.hadoop.ipc.RPC.checkVersion(RPC.java:422)
at org.apache.hadoop.hdfs.DFSClient.createNamenode(DFSClient.java:183)
at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:281)
at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:245)
at org.apache.hadoop.hdfs.DistributedFileSystem.initialize(DistributedFileSystem.java:100)
at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:1446)
at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:67)
at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:1464)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:263)
at org.apache.hadoop.fs.FsUrlConnection.connect(FsUrlConnection.java:45)
at org.apache.hadoop.fs.FsUrlConnection.getInputStream(FsUrlConnection.java:56)
at java.net.URL.openStream(URL.java:1037)
at URLCat.main(URLCat.java:12)
Caused by: java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:735)
at org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206)
at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:511)
at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:481)
at org.apache.hadoop.ipc.Client$Connection.setupConnection(Client.java:457)
at org.apache.hadoop.ipc.Client$Connection.setupIOstreams(Client.java:583)
at org.apache.hadoop.ipc.Client$Connection.access$2200(Client.java:205)
at org.apache.hadoop.ipc.Client.getConnection(Client.java:1249)
at org.apache.hadoop.ipc.Client.call(Client.java:1093)
... 22 more
(1)查看Hadoop进程:
[cloud@hdn01 hadoop-1.2.1]$ jps
16396 Jps
原来Hadoop还没有运行,晕!
[cloud@hdn01 hadoop-1.2.1]$ bin/start-all.sh
Warning: $HADOOP_HOME is deprecated.
starting namenode, logging to /opt/hadoop-1.2.1/libexec/../logs/hadoop-cloud-namenode-hdn01.out
hdd01: starting datanode, logging to /opt/hadoop-1.2.1/libexec/../logs/hadoop-cloud-datanode-hdd01.out
hdd02: starting datanode, logging to /opt/hadoop-1.2.1/libexec/../logs/hadoop-cloud-datanode-hdd02.out
hdn02: starting secondarynamenode, logging to /opt/hadoop-1.2.1/libexec/../logs/hadoop-cloud-secondarynamenode-hdn02.out
starting jobtracker, logging to /opt/hadoop-1.2.1/libexec/../logs/hadoop-cloud-jobtracker-hdn01.out
hdd01: starting tasktracker, logging to /opt/hadoop-1.2.1/libexec/../logs/hadoop-cloud-tasktracker-hdd01.out
hdd02: starting tasktracker, logging to /opt/hadoop-1.2.1/libexec/../logs/hadoop-cloud-tasktracker-hdd02.out
(2)重新查看Hadoop进程:
[cloud@hdn01 hadoop-1.2.1]$ jps
16647 JobTracker
16467 NameNode
16747 Jps
(3)重新运行URLCat示例:
[cloud@hdn01 hadoop-1.2.1]$ bin/hadoop URLCat hdfs://hdn01:9000/user/cloud/in/file1.txt
Warning: $HADOOP_HOME is deprecated.
Hello, world
[cloud@hdn01 hadoop-1.2.1]$
O了!!