Hadoop报错:Exception in thread "main" java.lang.NoClassDefFoundError: NameNode
编程技术  /  houtizong 发布于 3年前   144
刚刚在虚拟机上安装并配置了hadoop伪分布式集群,根据《hadoop实战》上的提示,启动Hadoop前需要格式化Hadoop的文件系统HDFS。命令如下:
[root@localhost hadoop-1.0.4]# bin/hadoop NameNode -format
执行命令后报错:
Exception in thread "main" java.lang.NoClassDefFoundError: NameNode
参考了网上的一些文章:
大部分给出的方案都是修改conf/hadoop-env.sh配置文件,增加
export HADOOP_COMMON_HOME=/root/hadoop-1.0.4 (hadoop的安装目录)
但是重新执行后还是报错
接下来又修改了环境变量,增加了HADOOP_HOME配置:
HADOOP_HOME=/root/hadoop-1.0.4PATH=$JAVA_HOME/bin:$PATH:$HADOOP_HOME/binexport CATALINA_HOME JAVA_HOME CLASSPATH PATH HADOOP_HOME
执行后还是报错。
之后仔细看了一些解决方案之后发现网上给出的正确命令是:
bin/hadoop namenode -format
其中namenode是小写,我把我的执行命令里NameNode修改为小写后再次执行,发现成功了
[root@localhost hadoop-1.0.4]# bin/hadoop namenode -format13/03/07 08:28:20 INFO namenode.NameNode: STARTUP_MSG: /************************************************************STARTUP_MSG: Starting NameNodeSTARTUP_MSG: host = localhost/127.0.0.1STARTUP_MSG: args = [-format]STARTUP_MSG: version = 1.0.4STARTUP_MSG: build = https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.0 -r 1393290; compiled by 'hortonfo' on Wed Oct 3 05:13:58 UTC 2012************************************************************/13/03/07 08:28:20 INFO util.GSet: VM type = 32-bit13/03/07 08:28:20 INFO util.GSet: 2% max memory = 19.84625 MB13/03/07 08:28:20 INFO util.GSet: capacity = 2^22 = 4194304 entries13/03/07 08:28:20 INFO util.GSet: recommended=4194304, actual=419430413/03/07 08:28:21 INFO namenode.FSNamesystem: fsOwner=root13/03/07 08:28:21 INFO namenode.FSNamesystem: supergroup=supergroup13/03/07 08:28:21 INFO namenode.FSNamesystem: isPermissionEnabled=true13/03/07 08:28:21 INFO namenode.FSNamesystem: dfs.block.invalidate.limit=10013/03/07 08:28:21 INFO namenode.FSNamesystem: isAccessTokenEnabled=false accessKeyUpdateInterval=0 min(s), accessTokenLifetime=0 min(s)13/03/07 08:28:21 INFO namenode.NameNode: Caching file names occuring more than 10 times 13/03/07 08:28:21 INFO common.Storage: Image file of size 110 saved in 0 seconds.13/03/07 08:28:21 INFO common.Storage: Storage directory /tmp/hadoop-root/dfs/name has been successfully formatted.13/03/07 08:28:21 INFO namenode.NameNode: SHUTDOWN_MSG: /************************************************************SHUTDOWN_MSG: Shutting down NameNode at localhost/127.0.0.1************************************************************/
格式化成功后启动Hadoop所有进程
[root@localhost hadoop-1.0.4]# bin/start-all.sh starting namenode, logging to /root/hadoop-1.0.4/libexec/../logs/hadoop-root-namenode-localhost.outlocalhost: starting datanode, logging to /root/hadoop-1.0.4/libexec/../logs/hadoop-root-datanode-localhost.outlocalhost: starting secondarynamenode, logging to /root/hadoop-1.0.4/libexec/../logs/hadoop-root-secondarynamenode-localhost.outstarting jobtracker, logging to /root/hadoop-1.0.4/libexec/../logs/hadoop-root-jobtracker-localhost.outlocalhost: starting tasktracker, logging to /root/hadoop-1.0.4/libexec/../logs/hadoop-root-tasktracker-localhost.out
启动后我们可以验证一下Hadoop是否安装成功,在浏览器中分别访问以下两个地址:
http://localhost:50030/ (MapReduce的web页面)
http://localhost:50070/ (HDFS的web页面)
如果都能访问,说明Hadoop已经安装成功。
附:参考资料
http://blog.csdn.net/zuoanlove/article/details/8255162
http://stackoverflow.com/questions/2004786/error-in-starting-namenode-in-hadoop
请勿发布不友善或者负能量的内容。与人为善,比聪明更重要!
技术博客集 - 网站简介:
前后端技术:
后端基于Hyperf2.1框架开发,前端使用Bootstrap可视化布局系统生成
网站主要作用:
1.编程技术分享及讨论交流,内置聊天系统;
2.测试交流框架问题,比如:Hyperf、Laravel、TP、beego;
3.本站数据是基于大数据采集等爬虫技术为基础助力分享知识,如有侵权请发邮件到站长邮箱,站长会尽快处理;
4.站长邮箱:[email protected];
文章归档
文章标签
友情链接