zoukankan      html  css  js  c++  java
  • windows配置hadoop环境变量

    1.首先需要下载 hadoop的tar.gz包,目前最新版本是2.9.0 下载地址:

    文件共享在最下面

    http://hadoop.apache.org/releases.html

    前提是JDK必须配置成功

    我的hadoop是在 如图解压在E盘下  解压完之后大概是2G多需要一点时间啊

    2.修改etchadoop下的文件(注意以下配置文件下所有的地址都是从Linux集群中的hadoop  jar粘贴复制过来的)

    4个配置文件

     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.defaultFS</name>
       <value>hdfs://master:9000</value>
    </property>
    
      <property>
         <name>hadoop.tmp.dir</name>
         <value>/usr/local/hadoop-2.8.0/tmp</value> //linux集群中的地址
    </property>
    
    </configuration>

    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>
      <property>
        <name>mapreduce.jobhistory.address</name>
        <value>master:10020</value>
      </property>
      <property>
        <name>mapreduce.jobhistory.address</name>
        <value>master:19888</value>
      </property>
    
    </configuration>

    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>
    <property>
          <name>dfs.namenode.secondary.http-address</name>
          <value>master:50090</value>
        </property>
        <property>
          <name>dfs.replication</name>
          <value>2</value>
        </property>
        <property>
          <name>dfs.namenode.name.dir</name>
          <value>file:/usr/local/hadoop-2.8.0/hdfs/name</value>
        </property>
        <property>
          <name>dfs.datanode.data.dir</name>
          <value>file:/usr/local/hadoop-2.8.0/hdfs/data</value>
        </property>
    
    </configuration>

    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>
    
    <!-- Site specific YARN configuration properties -->
    
    <property>
              <name>yarn.nodemanager.aux-services</name>
              <value>mapreduce_shuffle</value>
      </property>
      <property>
               <name>yarn.resourcemanager.address</name>
               <value>master:8032</value>
      </property>
      <property>
              <name>yarn.resourcemanager.scheduler.address</name>
              <value>master:8030</value>
      </property>
    <property>  
        <name>yarn.log-aggregation-enable</name>  
        <value>true</value>  
    </property> 
    
     <property>
             <name>yarn.resourcemanager.resource-tracker.address</name>
             <value>master:8031</value>
         </property>
         <property>
             <name>yarn.resourcemanager.admin.address</name>
             <value>master:8033</value>
         </property>
         <property>
             <name>yarn.resourcemanager.webapp.address</name>
             <value>master:8088</value>
         </property>
    
          
    </configuration>

    3.配置环境变量

    此电脑--属性--高级系统设置--环境变量

    新建系统变量

    变量名:HADOOP_HOME

    变量值:你的hadoop位置  E:hadoophadoop-2.8.0hadoop-2.8.0

    编辑Path系统路径   %HADOOP_HOME%in

    然后一路确定下来

    4.编辑hadoop的文件

    如下打开 etchadoophadoop-enc.cmd文件,修改JAVA_HOME为你自己的jdk路径 。注意你的JDK安装在Program Files目录下,

    名称用名称用PROGRA~1Java 否则中间的空格可能会识别失败。

    到此为止配置完毕 如果不行的化可能需要点右键运行一遍

    5.window+r打开 cmd窗口输入 hadoop测试

    配置成功 也可以格式化节点具体命令是

    1、切换到etc/hadoop目录,运行hadoop-env.cmd

    2、格式化HDFS文件系统,切换到bin目录然后执行命令:hdfs namenode -format

  • 相关阅读:
    FineBI与power BI,一个是国外风生水起的微软巨头,一个是方兴未艾的国产BI厂商领导者
    Linux下的crontab定时执行任务命令详解举例
    手把手教你搭建SSH框架(Eclipse版)
    一、连接池的定义
    centos安装sftp服务win搭建 sftp 服务器
    前往阿里云的企业优惠活动页面
    世界可能是思想最为混乱的时候,无论你说什么
    python面向对象编程class1
    Python 文件I/O 文件读写模式r,r+,w,w+,a,a+的区别
    Python中的装饰器是你进入Python大门的一道坎,不管你跨不跨过去它都在那里
  • 原文地址:https://www.cnblogs.com/lcycn/p/8595945.html
Copyright © 2011-2022 走看看