刚刚在虚拟机上安装并配置了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.4 PATH=$JAVA_HOME/bin:$PATH:$HADOOP_HOME/bin export CATALINA_HOME JAVA_HOME CLASSPATH PATH HADOOP_HOME
执行后还是报错。
之后仔细看了一些解决方案之后发现网上给出的正确命令是:
bin/hadoop namenode -format
其中namenode是小写,我把我的执行命令里NameNode修改为小写后再次执行,发现成功了
[root@localhost hadoop-1.0.4]# bin/hadoop namenode -format 13/03/07 08:28:20 INFO namenode.NameNode: STARTUP_MSG: /************************************************************ STARTUP_MSG: Starting NameNode STARTUP_MSG: host = localhost/127.0.0.1 STARTUP_MSG: args = [-format] STARTUP_MSG: version = 1.0.4 STARTUP_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-bit 13/03/07 08:28:20 INFO util.GSet: 2% max memory = 19.84625 MB 13/03/07 08:28:20 INFO util.GSet: capacity = 2^22 = 4194304 entries 13/03/07 08:28:20 INFO util.GSet: recommended=4194304, actual=4194304 13/03/07 08:28:21 INFO namenode.FSNamesystem: fsOwner=root 13/03/07 08:28:21 INFO namenode.FSNamesystem: supergroup=supergroup 13/03/07 08:28:21 INFO namenode.FSNamesystem: isPermissionEnabled=true 13/03/07 08:28:21 INFO namenode.FSNamesystem: dfs.block.invalidate.limit=100 13/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.out localhost: starting datanode, logging to /root/hadoop-1.0.4/libexec/../logs/hadoop-root-datanode-localhost.out localhost: starting secondarynamenode, logging to /root/hadoop-1.0.4/libexec/../logs/hadoop-root-secondarynamenode-localhost.out starting jobtracker, logging to /root/hadoop-1.0.4/libexec/../logs/hadoop-root-jobtracker-localhost.out localhost: 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
相关推荐
解决方案:Exceptionin thread "main" java.lang.UnsatisfiedLinkError:org.apache.hadoop.util.NativeCrc32.nativeCo
`Exception in thread "main" java.lang.NoClassDefFoundError` 是Java编程中常见的一个运行时异常,通常发生在尝试运行一个Java程序时,如果JVM找不到在类路径(ClassPath)中定义的主要类(主类,即包含`public ...
运行Sqoop报错:Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/avro/LogicalType,下载此资源放到Sqoop的lib目录下即可
"java.lang.NoClassDefFoundError错误解决办法" java.lang.NoClassDefFoundError错误是一种常见的Java错误,它发生在Java虚拟机在编译时能找到合适的类,而在运行时不能找到合适的类导致的错误。下面是该错误的解决...
Exception in thread “main” java. lang . UnsatisfiedLinkError: org. apache . hadoop. io. nativeio. NativeIOSWindows . access0 (Ijava/ lang/String;I)Z 原因:在调用NativeIO中的...
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jersey/api/client/config/ClientConfig at org.apache.hadoop.yarn.client.api.TimelineClient.createTimelineClient(TimelineClient.java:...
在这个特定的场景中,异常堆栈跟踪显示了 `Caused by: java.lang.ClassNotFoundException: org.apache.commons.collections.Transformer`,这表明系统无法找到 `org.apache.commons.collections.Transformer` 类。...
在Java编程中,`NoSuchMethodError` 是一个常见的运行时异常,它表示在类加载时找到了该类,但在该类中却找不到特定方法的定义。这个问题通常发生在不同版本的库之间存在不兼容的情况,即在编译时使用的库版本包含了...
flink-hadoop-compatibility_2.12-1.7.1.jar javax.ws.rs-api-2.0.1.jar jersey-common-2.27.jar ...Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jersey/api/client/config/ClientConfig
Exception in thread "main" java.lang.UnsatisfiedLinkError:''boolean org.apache.hadoop.io.nativeio.NativeIO$Windows.access0(java.lang.String, int)' * at org.apache.hadoop.io.nativeio.NativeIO$...
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70) at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183) at org.apache.sqoop.Sqoop.runTool(Sqoop.java:234) at org.apache.sqoop.Sqoop.runTool...
org.apache.hadoop.mapred.YarnChild: Error running child : java.lang.IncompatibleClassChangeError: Found interface org.apache.hadoop.mapreduce.TaskAttemptContext, but class was expected at org.apache...
问题描述:Hadoop抛出java.lang.OutOfMemoryError: Java heap space错误。 解决办法:该问题是由于JVM内存不足所致。解决办法是修改所有的DataNode的JVM内存大小,例如设置为-Xms1024m -Xmx4096m。 问题8:...
hadoop安装与配置 hadoop安装与配置 Hadoop的安装与配置可以分成几个主要步骤: 1. 安装Java 2. 下载Hadoop 3. 配置Hadoop 4. 格式化Hadoop文件系统 5. 启动Hadoop 以下是基于Linux系统的简化安装与配置步骤: 1. ...
【SpringBoot】Error: java.lang.ClassNotFoundException: org.wltea.analyzer.core.IKSegmenter报错明细问题分析后记 报错明细 IDEA SpringBoot集成hadoop运行环境,本地启动项目,GET请求接口触发远程提交...
at org.apache.hadoop.mapred.TaskTracker.main(TaskTracker.java:3694) eclipse运行作业 Failed to set permissions of path: \tmp\hadoop-admin\mapred\staging\Administrator-1506477061\.staging to 0700 :...
报错:java.lang.Exception: java.lang.UnsatisfiedLinkError: org.apache.hadoop.io.nativeio.NativeIO$Windows.access0(Ljava/lang/String;I)Z 所需文件
CDH集群大数据hadoop报错解决办法及思路整理,主要解决大数据在运行过程中所遇到的问题,相关解决办法都是实践验证过。