Hadoop运行中遇到的错误调试

在运行Hadoop的过程中遇到的最多的问题就是DataNode不能正常的启动,各种问题都有可能,说一下我遇到的两种情况:

(1)第一种情况是Master的防火墙没有关闭。这样在启动Hadoop的时候,Master这个节点可以正常的启动,但是Master的防火墙开启以后,使得Slave不能访问Master的9000端口。这种情况,在Slave的DataNode启动后又立即关闭了。

(2)第二种情况的原因:每次NameNode -format会重新创建一个NameNode ID,而tmp/dfs/data/current下的文件VERSION中包含了上次format下的ID,NameNode -format清空了NameNode下的数据,但是没有清空DataNode下的数据,导致启动时失败。所要做的就是每次fotmat前,清空tmp一下的所有目录。

在说完上面的两个问题之后,说一个怎么强调都不过分的东西,那就是要学会看运行的日志信息。上面的两个问题都会在日志中有显示。

哪个节点没有启动,就查哪个节点的logs文件夹下的日志信息。以第二个问题为例,DataNode没有启动就能看到那个结点的日志信息:

2010-07-21 10:12:11,987 ERROR org.apache.hadoop.hdfs.server.datanode.DataNode: java.io.IOException: Incompatible namespaceIDs in /home/admin/joe.wangh/hadoop/data/dfs.data.dir: namenode namespaceID = 898136669; datanode namespaceID = 2127444065
        at org.apache.hadoop.hdfs.server.datanode.DataStorage.doTransition(DataStorage.java:233)
        at org.apache.hadoop.hdfs.server.datanode.DataStorage.recoverTransitionRead(DataStorage.java:148)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.startDataNode(DataNode.java:288)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.<init>(DataNode.java:206)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.makeInstance(DataNode.java:1239)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.instantiateDataNode(DataNode.java:1194)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.createDataNode(DataNode.java:1202)
        at org.apache.hadoop.hdfs.server.datanode.DataNode.main(DataNode.java:1324)

错误提示namespaceIDs不一致。

找到错误的原因之后,才能对症下药,找到解决问题的办法:

下面给出两种解决办法,我使用的是第二种。

Workaround 1: Start from scratch

I can testify that the following steps solve this error, but the side effects won‘t make you happy (me neither). The crude workaround I have found is to:

1.     stop the cluster

2.     delete the data directory on the problematic datanode: the directory is specified by dfs.data.dir in conf/hdfs-site.xml; if you followed this tutorial, the relevant directory is /usr/local/hadoop-datastore/hadoop-hadoop/dfs/data

3.     reformat the namenode (NOTE: all HDFS data is lost during this process!)

4.     restart the cluster

When deleting all the HDFS data and starting from scratch does not sound like a good idea (it might be ok during the initial setup/testing), you might give the second approach a try.

Workaround 2: Updating namespaceID of problematic datanodes

Big thanks to Jared Stehler for the following suggestion. I have not tested it myself yet, but feel free to try it out and send me your feedback. This workaround is "minimally invasive" as you only have to edit one file on the problematic datanodes:

1.     stop the datanode

2.     edit the value of namespaceID in <dfs.data.dir>/current/VERSION to match the value of the current namenode

3.     restart the datanode

If you followed the instructions in my tutorials, the full path of the relevant file is /usr/local/hadoop-datastore/hadoop-hadoop/dfs/data/current/VERSION (background: dfs.data.dir is by default set to ${hadoop.tmp.dir}/dfs/data, and we set hadoop.tmp.dir to /usr/local/hadoop-datastore/hadoop-hadoop).

If you wonder how the contents of VERSION look like, here‘s one of mine:

#contents of <dfs.data.dir>/current/VERSION

namespaceID=393514426

storageID=DS-1706792599-10.10.10.1-50010-1204306713481

cTime=1215607609074

storageType=DATA_NODE

layoutVersion=-13

时间: 2024-08-03 20:15:09

Hadoop运行中遇到的错误调试的相关文章

Hadoop运行wordcount时报classnotfound错误的一个原因

我们在按照网上铺天盖地的教程开始运行wordcount时,有时会得到一个报错.如下所示 /usr/local/hadoop-1.2.1/bin# ./hadoop jar /home/ftp/temp/wordcount.jar WordCount /home/input /home/output Exception in thread "main" java.lang.ClassNotFoundException: WordCount at java.net.URLClassLoad

JavaScript错误调试

错误调试与处理 / 2-1 语法错误 语法错误: 不符合js语法的错误,控制台会告知出错的行号(但行号不一定准确). 常见语法错误: 1,符号漏错多少打. 2,使用了不合语法的变量名.(关键字,保留字不能做变量名). 3,语句写错,没写完等. 错误提示: Uncaught SyntaxError:Unexpected token xxx //未预料到xxx. identifier:变量名. 逗号表达式将会返回最后一个表达式的结果  错误调试与处理 / 2-2 运行时错误 运行时错误(Runtim

将任意Bytecode注入运行中的Python进程

在调试 Python 程序的时候,一般我们只能通过以下几种方式进行调试: 1. 程序中已经有的日志 2. 在代码中插入 import pdb; pdb.set_trace() 但是以上的方法也有不方便的地方, 比如对于已经在运行中的程序, 就不可能停止程序后加入 调试代码和增加新的日志. 从 JAVA 的 BTrace(https://kenai.com/projects/btrace) 项目得到灵感,尝试对正在运行的 Python 进程插入代码,在程序运行到指定的函数后,自动连接远程主机进行调

调试与运行结果不一致?第一次运行正确,后面错误,由于多线程修改UI吗?

先说说问题背景:使用Eclipse安装android程序到手机,调试ok,达到预想效果,退出,重新打开程序,No,部分UI界面未显示,Why? 首先想到的是多线程问题,调试与运行结果不一致说明中间存在时间差,因为单步调试的时候时间会被延长,然后找原因点,程序中修改UI 的代码分两部分,1部分修改好友图像,2部分更新地图,1是通过AsyncHttpClient异步从后台取数据,2则不涉及异步问题,在线程上测试了 很久,没搞定. 今天早上过来,突然意识到,修改地图的activity是新增的,不像其他

ejabberd 在eclipse(erlide)中的配置、调试、运行

最近在折腾ejabberd,将ejabberd项目配置到eclipse中进行编译.调试等,现在将过程记下来,希望能帮助到需要的人. 准备 本次环境是在linux中进行,博主的linux是fedora20. 安装erlang 安装eclipse 安装eclipse插件:erlide 以上安装过程请自行搜索相关教程,本文略. 下面我们就把将ejaberd导入eclipse过程中所遇到的问题各个击破. 下载ejabberd项目源代码,将整个工程导入到eclipse中,怎么导就别问我啦!然后就是惨不忍睹

hadoop安装过程中出现的错误

此次来记录一下我在安装Hadoop安装过程中出现的错误,安装过程参照慕课网林子雨教程进行安装,在尝试过程中出现的错误如下: 1.在安装Ubuntu时,新建虚拟电脑时,并没有在版本的输入框中有Ubuntu(64bit)的显示,得在电脑图标出现之前,进入blos开启CPU的虚拟化,然后才能正常显示 2.配置JAVA_HOME环境变量时,用vim进行在文件中语句输入,操作不会,后来知道用E键编辑,用i键插入,然后esc退出编辑,wq键保存文件并退出,完成文件更改 3.在将hadoop解压到/usr/l

使用 gdb 调试运行中的 Python 进程

本文和大家分享的是使用 gdb 调试运行中的 Python 进程相关内容,一起来看看吧,希望对大家学习python有所帮助. 准备工作 安装 gdb 和 python2.7-dbg: $ sudo apt-get install gdb python2.7-dbg 设置 /proc/sys/kernel/yama/ptrace_scope: $ sudo su# echo 0 > /proc/sys/kernel/yama/ptrace_scope 运行 test.py: $ python te

01- - -1.获得项目中info.plist文件的内容 2.沙盒的数据存储及读取 3.控制器view的高度和状态栏statusBar的关系 4.[UIScreen mainScreen].applicationFrame的取值 5.按钮的状态 6.错误调试技巧 7.按钮的各种状态设置

1.获得项目中info.plist文件的内容 1> [NSBundle mainBundle].infoDictionary 2> 版本号在info.plist中的key:kCFBundleVersionKey 2.沙盒的数据存储及读取 1> 数据存储: [[NSUserDefaults standardUserDefaults] setObject:version forKey:versionKey]; 存储数据时记得同步一下 [[NSUserDefaults standardUser

QT中运行程序时出现错误“ QApplication: No such file or directory&quot;

在根目录下创建 一个文件夹,名称为hello,在该文件夹下创建一个hello.cpp文件,内容如下: #include <QApplication> #include <QLabel> int main(int argc, char **argv) { QApplication a(argc, argv); QLabel mylabel("Hello the World"); mylabel.show(); return a.exec(); } 在该文件下运行以