ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

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

2022-02-16 10:04:09  阅读:191  来源: 互联网

标签:xml hdfs Windows hadoop site 报错 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的端口时说的就是这里的错误,解决方法就是修改一个其他的端口就可以了。

 

共同学习交流

标签:xml,hdfs,Windows,hadoop,site,报错,namenode
来源: https://www.cnblogs.com/zerofc/p/15899120.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有