Windows下hadoop环境搭建之NameNode启动报错

前言:

        因为平时工作和日常接触到的大都是的中型项目,所以少有个性化推荐等涉及大数据的功能。但是后期应该也会在自己项目中添加信息推荐模块,所以就开始关注spark,hadoop,Thrift等工具,以下就以hadoop先开始,包括环境搭建和配置过程中踩坑过程。

        关于hadoop的环境搭建,网上也有各种各样的教程。拿来直接按着他们的方法来,前期当前问题不大,但是呢,可能在安装过程中由于每个工具的版本不一致。又或者配置中文件路径不一样等等都很可能导致踩坑无数。不管是开发调测bug还是软件环境搭建,我觉得最好的方法就是看日志,看到error和warn再把错误信息拿去查询,比起xxxx启动报错,xxxx怎么出错了等等确实要快。

环境:

1. windows10

2.  jdk8

3.  hadoop2.7.7,点击下载

简易搭建:

1.  windows下jdk8的安装,略过。

2. hadoop2.7.7下载完成。

3.  hadooponwindows-master.zip文件包下载。

      https://pan.baidu.com/s/1vxtBxJyu7HNmOhsdjLZkYw 提取码:y9a4这个是我在网上找的网盘下载地址。hadoop和hadooponwindows全都下载完成后,将hadooponwindows-master的bin和etc替换掉hadoop2.7.7的bin和etc文件。

4.  hadoop环境变量配置,略过。

5.  hadoop配置。

(1). hadoop-env.cmd配置:

找到hadoop的etc/hadoop下的hadoop-env.cmd并打开,设置本地jdk的位置,路径中不能有汉字特殊字符等,如下。

(2). hdfs-site.xml配置:

找到hadoop的etc/hadoop下的hdfs-site.xml并打开,在configuration添加如下参数。特别注意的是namenode和datanode两个节点数据存储位置,一定要添加file://协议。并且绝对路径前一定要加“/”,因为这个会导致出现报错的问题,后面再讲。还有windows的路径标识“/”,配置如下。

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License. See accompanying LICENSE file.
-->

<!-- Put site-specific property overrides in this file. -->

<configuration>
 <property>
        <name>dfs.replication</name>
        <value>1</value>
    </property>
    <property>
        <name>dfs.namenode.name.dir</name>
        <value>file:///E:/2setsoft/1dev/hadooponwindows/data/namenode</value>
    </property>
    <property>
        <name>dfs.datanode.data.dir</name>
        <value>file:///E:/2setsoft/1dev/hadooponwindows/data/datanode</value>
    </property>
</configuration>

(3).  core-site.xml配置:

找到hadoop的etc/hadoop下的core-site.xml并打开,在configuration添加如下参数。特别注意的是hdfs的端口,因为作为开发本地出现9000端口应该很多,所以这里就先强调记得这里是配置端口的就行,以下是配置。

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License. See accompanying LICENSE file.
-->

<!-- Put site-specific property overrides in this file. -->

<configuration>
    <property>
        <name>fs.defaultFS</name>
        <value>hdfs://127.0.0.1:9500</value>
    </property>
	
	<property>
	  <name>ipc.client.connect.max.retries</name>
	  <value>100</value>
	  <description>Indicates the number of retries a client will make to establish
		  a server connection.
	  </description>
	</property>
 
	<property>
	  <name>ipc.client.connect.retry.interval</name>
	  <value>10000</value>
	  <description>Indicates the number of milliseconds a client will wait for
	  before retrying to establish a server connection.
	  </description>
	</property>
 
</configuration>

6. hadoop启动。

(1).  namenode格式化:

打开cmd面板,输入hdfs namenode -format。出现需要确认创建namenode文件夹的基本上是没问题。

(2).  hadoop启动:

切换到hadoop的sbin目录下执行start-all就会弹出四个窗口,datanode, namenode, resourcemanager, nodemanager。

(3). 检查各节点启动情况:

输入jps -,出现以下内容表示全部启动成功,以上四个少了一个都是有问题,就需要去对应窗口查看报错信息查询了。

(4). 查看web控制台:

hadoop的web控制台:127.0.0.1:50070

yarn的web控制台:127.0.0.1:8088

namenode启动报错集锦

1. namenode.FSEditLog: No class configured for E, dfs.namenode.edits.journal-plugin.E is empty

        这个报错的原因就是hdfs-site.xml配置namenode文件位置开头没有加“/”,这个已经在上面配置的时候已经强调了。

2. common.Util: Path /E:/2setsoft/1dev/hadooponwindows/data/namenode should be specified as a URI in configuration files. P

        这个报错的原因还是hdfs-site.xml配置namenode文件位置时没有添加“file://”,所以上面的配置时最正确的。

3. ERROR namenode.NameNode: Failed to start namenode. java.net.BindException: Problem binding to [127.0.0.1:9000] java.net.BindException: Address already in use: bind; For more details see: http://wiki.apache.org/hadoop/BindException

        这个报错的原因就是9000端口已经被绑定了,所以前面强调core-site.xml的端口时说的就是这里的错误,解决方法就是修改一个其他的端口就可以了。

共同学习交流

  • 7
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值