大数据开发之windows安装hadoop教程

第一步 安装JDK

第二步 安装Hadoop

  1. 下载hadoop地址:http://archive.apache.org/dist/hadoop/common/hadoop-3.2.2/ 2. 下载hadoop-winutils https://github.com/cdarlint/winutils
    在这里插入图片描述

将红色方框里面的文件复制到hadoop-3.2.2\bin目录中,hadoop主要基于linux编写,这个winutil.exe主要用于模拟linux下的目录环境。因此hadoop放在windows下运行的时候,需要这个辅助程序才能运行。

第三步 配置hadoop

  1. 配置环境变量:
    新增系统变量 HADOOP_HONE
    在这里插入图片描述
    编辑系统变量中的Path
    在这里插入图片描述
  2. 进入hadoop安装文件夹下的etc/hadoop文件夹,修改以下文件内容:

(1)core-site.xml

<?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.default.name</name>
        <value>hdfs://localhost:9000</value>
    </property>
</configuration>

(2)hdfs-site.xml

<?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>
    <!-- 这个参数设置为1,因为是单机版hadoop -->
    <property>
        <name>dfs.replication</name>
        <value>1</value>
    </property>
	 <property>
        <name>dfs.namenode.name.dir</name>
          <!-- 需要先创建此目录 -->
        <value>file:/G:/hadoop/data/dfs/namenode</value>
    </property>
    <property>
        <name>dfs.datanode.data.dir</name>
         <!-- 需要先创建此目录 -->
        <value>file:/G:/hadoop/data/dfs/datanode</value>
    </property>
	 <property>
        <name>dfs.http.address</name>
        <value>0.0.0.0:50070</value>
    </property>
	  <property>
        <name>dfs.permissions</name>
         <!-- 以便在网页中可以创建、上传文件 -->
        <value>false</value>
    </property>
</configuration>

(3)mapred-site.xml

<?xml version="1.0"?>
<?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>mapreduce.framework.name</name>
      <value>yarn</value>
    </property>

</configuration>

(4)yarn-site.xml

<?xml version="1.0"?>
<!--
  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.
-->
<configuration>
  <property>
     <name>yarn.nodemanager.aux-services</name>
     <value>mapreduce_shuffle</value>
   </property>
  <property>
     <name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>
     <value>org.apache.hadoop.mapred.ShuffleHandler</value>
   </property>
</configuration>

第四步:进入cmd控制台输入:hdfs namenode -format

在这里插入图片描述

第五步:控制台进入sbin文件夹,输入:start-all.cmd

出现如下四个界面说明启动成功
在这里插入图片描述

第六步:浏览器输入:http://localhost:8088

在这里插入图片描述

第七步:浏览器输入:http:localhost:50070

在这里插入图片描述

至此,hadoop安装成功!!!

第七步:停止hadoop, 控制台进入sbin文件夹,输入:stop-all.cmd

  • 3
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值