错误一:
2010-11-09 16:59:07,307 INFO org.apache.hadoop.ipc.Server: Error register getProtocolVersion
java.lang.IllegalArgumentException: Duplicate metricsName:getProtocolVersion
at org.apache.hadoop.metrics.util.MetricsRegistry.add(MetricsRegistry.java:53)
at org.apache.hadoop.metrics.util.MetricsTimeVaryingRate.<init>(MetricsTimeVaryingRate.java:89)
at org.apache.hadoop.metrics.util.MetricsTimeVaryingRate.<init>(MetricsTimeVaryingRate.java:99)
at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:523)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:959)
at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:955)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:396)
at org.apache.hadoop.ipc.Server$Handler.run(Server.java:953)
可能的解决方法是:
可能是mapred-site.xml文件的mapred.job.tracker节点配置成IP了
原来的格式:
<property>
<name>mapred.job.tracker</name>
<value>192.168.75.17:9001</value>
</property>
应该改成
<property>
<name>mapred.job.tracker</name>
<value>jobtracker:8021</value>
</property>
问题解决!
问题二:
2012-03-15 16:57:01,391 ERROR org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode: java.net.ConnectException: Connection refused拒绝连接
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:198)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
at java.net.Socket.connect(Socket.java:579)
at java.net.Socket.connect(Socket.java:528)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.(HttpClient.java:388)
at sun.net.(HttpClient.java:483)
at sun.net.(HttpClient.java:213)
at sun.net.(HttpClient.java:300)
at sun.net.(HttpClient.java:316)
at sun.net.(HttpURLConnection.java:992)
at sun.net.(HttpURLConnection.java:928)
at sun.net.(HttpURLConnection.java:846)
at sun.net.(HttpURLConnection.java:1296)
at org.apache.hadoop.hdfs.server.namenode.TransferFsImage.getFileClient(TransferFsImage.java:160)
at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode$3.run(SecondaryNameNode.java:347)
at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode$3.run(SecondaryNameNode.java:336)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:415)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1059)
at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.downloadCheckpointFiles(SecondaryNameNode.java:336)
at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.doCheckpoint(SecondaryNameNode.java:411)
at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.doWork(SecondaryNameNode.java:312)
at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.run(SecondaryNameNode.java:275)
at java.lang.Thread.run(Thread.java:722)
secondary namenoded 配置很容易被忽视,如果jps检查都正常,大家通常不会太关心,除非namenode发生问题的
时候,才会想起还有个secondary namenode,它的配置共两步:
-
集群配置文件conf/master中添加secondarynamenode的机器名
-
修改/添加 hdfs-site.xml中如下属性:
<property>
<name>dfs.http.address</name>
<value>{your_namenode_ip}:50070</value>
<description>
The address and the base port where the dfs namenode web ui will listen on.
If the port is 0 then the server will start on a free port.
</description>
</property>
三、如果错误是java.net.NoRouteToHostException:
No route to host: connect
查看下防火墙有没有关上
四、如果无法连接datanode,看看tmp文件有没有全部删除
五、error:All datanodes *** are bad. Aborting...
类似这样的错误,常常会在并行的put操作比较多,比如60-80个,每个put的数据量约100G的时候,产生类似的错误,错误出现以后,比较好一点的情况是DFSClient端会报出一些列的错误log,如:
error Recovery for block block_-13954o849583405 bad datanode ** "
Bad response for block block_-254u94545923 from datanode ***
产生这样的报错后,put操作仍然能够进行,并最终数据上传是完整的,只是效率会收到影响。
但是如果碰到不好的情况,就会报出:
All datanodes *** are bad. Aborting...
这样的错误,这样就会导致put操作中断,导致数据上传不完整。
根据log查看hadoop的代码发现,出错的地方在 DFSClient 的 processDatanodeError()方法中,进入这个方法就表示DFSClient的操作发生了错误。而进入这个报错的代码逻辑是因为 DFSClient中发现errorIndex > 0,继续跟踪,发现修改了errorIndex变量的方法调用中,只有 createBlockOutputStream,DFSOutputStream的构造方法,以及ResponseProcessor.run()方法 中对该变量进行了修改,而由于DFSOutputStream的构造方法对该变量进行的修改是在append的时 候,ResponseProcessor.run()会直接抛出另外的异常,因此调用定位到createBlockOutputStream() 方法中,最后发现修改errorIndex的原因是由于 某个datanode的link跟dfsclient短发生了失败,根据log中发现失败是由于socket链接超时导致,这说明,put发生异常的时 候,是DFSClient 链接从namenode得来的datanode列表中的datanode时,由于该datanode当时的负载非常的高,导致当时无法服务造成。
由于DFSClient跟datanode的链接超时控制参数是一个客户端参数,因此,在数据上传的客户端hadoop- site.xml里修改配置参数 dfs.socket.timeout(默认十分钟),之后重新运行大批量的数据上传操作,同时,用命令ulimit -n可以发现linux默认的文件打开数目为1024,修改/ect/security/limit.conf,增加hadoop soft 65535,提高hadoop程序可以默认打开的文件的数目
六、运行一段时间后hadoop不能stop-all.sh的问题,显示报错
no tasktracker to stop ,no datanode to stop
问题的原因是hadoop在stop的时候依据的是datanode上的mapred和dfs进程号。而默认的进程号保存在/tmp下,linux 默认会每隔一段时间(一般是一个月或者7天左右)去删除这个目录下的文件。因此删掉hadoop-hadoop-jobtracker.pid和 hadoop-hadoop-namenode.pid两个文件后,namenode自然就找不到datanode上的这两个进程了。
在配置文件hadoop_env.sh中配置export HADOOP_PID_DIR可以解决这个问题
错误七:没有到主机的路由。。。
2012-07-11 19:40:02,158 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: jobtracker/192.168.0.198:8021. Already tried 0 time(s).
2012-07-11 19:40:03,161 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: jobtracker/192.168.0.198:8021. Already tried 1 time(s).
2012-07-11 19:40:04,164 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: jobtracker/192.168.0.198:8021. Already tried 2 time(s).
2012-07-11 19:40:05,166 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: jobtracker/192.168.0.198:8021. Already tried 3 time(s).
2012-07-11 19:40:06,167 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: jobtracker/192.168.0.198:8021. Already tried 4 time(s).
2012-07-11 19:40:07,171 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: jobtracker/192.168.0.198:8021. Already tried 5 time(s).
2012-07-11 19:40:08,174 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: jobtracker/192.168.0.198:8021. Already tried 6 time(s).
2012-07-11 19:40:09,180 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: jobtracker/192.168.0.198:8021. Already tried 7 time(s).
2012-07-11 19:40:10,185 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: jobtracker/192.168.0.198:8021. Already tried 8 time(s).
2012-07-11 19:40:11,189 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: jobtracker/192.168.0.198:8021. Already tried 9 time(s).
2012-07-11 19:40:11,192 INFO org.apache.hadoop.ipc.RPC: Server at jobtracker/192.168.0.198:8021 not available yet, Zzzzz...
INFO org.apache.hadoop.ipc.Client: Retrying connect to server: jobtracker 没有到主机的路由
我的解决方法是把/etc/hosts文件的第一行127.0.0.1注释掉,然后在后面加上主机的ip地址和名称
8、有时,当你申请到一个HOD集群后马上尝试上传文件到HDFS时,DFSClient会警告NotReplicatedYetException。通常会有一个如下报错信息。
org.apache.hadoop.ipc.RemoteException: java.io.IOException File /root/testdir/hadoop-default.xml could only be replicated to 0 nodes, instead of 1
at org.apache.hadoop.dfs.FSNamesystem.getAdditionalBlock(FSNamesystem.java:1123)
at org.apache.hadoop.dfs.NameNode.addBlock(NameNode.java:330)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
……
不幸的是我也遇到了这个报错,google了很久才找到一个解决方案:当你向一个DataNodes正在和NameNode联络的集群上传文件的时候,这种现象就会发生。在上传新文件到HDFS之前多等待一段时间就可以解决这个问题,因为这使得足够多的DataNode启动并且联络上了NameNode。
9、Error: Java heap space
mapred-site.xml中设置
<property>
<name>mapred.child.java.opts</name>
<value>-Xmx512m</value>
</property>
调整这个数字。
10、 Namenode in safe mode
解决方法
bin/hadoop dfsadmin -safemode leave
阅读(1500) | 评论(0) | 转发(0) |