hadoop环境变量的配置

hadoop环境变量的配置  转载链接:https://www.cnblogs.com/lcycn/p/8595945.html

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

文件共享在最下面

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

前提是JDK必须配置成功

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

2.修改etc\hadoop下的文件(注意以下配置文件下所有的地址都是从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:\hadoop\hadoop-2.8.0\hadoop-2.8.0

编辑Path系统路径   %HADOOP_HOME%\bin

然后一路确定下来

4.编辑hadoop的文件

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

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

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

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

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

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

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

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值