关于运维:Windows下hadoop环境搭建之NameNode启动报错

6次阅读

共计 3930 个字符,预计需要花费 10 分钟才能阅读完成。

前言:

因为平时工作和日常接触到的大都是的中型我的项目,所以少有个性化举荐等波及大数据的性能。然而前期应该也会在本人我的项目中增加信息举荐模块,所以就开始关注 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 文件包下载。
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;
这个报错的起因就是 9000 端口曾经被绑定了,所以后面强调 core-site.xml 的端口时说的就是这里的谬误,解决办法就是批改一个其余的端口就能够了。

正文完
 0