欢迎投稿

今日深度:

Hadoop,

Hadoop,


<?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.name.dir</name>


   <value>/root/hadoop/dfs/name</value>


   <description>Path on the local filesystem where theNameNode stores the namespace and transactions logs persistently.</description>


</property>


<property>


   <name>dfs.data.dir</name>


   <value>/root/hadoop/dfs/data</value>


   <description>Comma separated list of paths on the localfilesystem of a DataNode where it should store its blocks.</description>


</property>


<property>


   <name>dfs.replication</name>


   <value>4</value>


</property>


<property>


      <name>dfs.permissions</name>


      <value>false</value>


      <description>need not permissions</description>


</property>


<property>


        <name>heartbeat.recheck.interval</name>


        <value>5000</value>


</property>






<property>


        <name>dfs.heartbeat.interval</name>


        <value>2</value>


</property>


</configuration>

1. Hadoop集群安装
6.1opt目录下新建一个名字为hadoop的目录,将解压后的hadoop-2.8.2文件夹放进该目录下

6.2
新建几个目录

           在/root目录下新建几个目录,复制粘贴执行下面的命令:

[root@Master ~]# mkdir  /root/hadoop  

[root@Master ~]# mkdir  /root/hadoop/tmp

[root@Master ~]# mkdir  /root/hadoop/var

[root@Master ~]# mkdir  /root/hadoop/dfs

[root@Master ~]# mkdir  /root/hadoop/dfs/name

[root@Master ~]# mkdir  /root/hadoop/dfs/data

 

 

6.3 修改etc/hadoop中的一系列配置文件

          修改/opt/hadoop/hadoop-2.8.0/etc/hadoop目录内的一系列文件。

 

 A.修改core-site.xml

           <configuration>

   <property>

        <name>hadoop.tmp.dir</name>

        <value>/root/hadoop/tmp</value>

        <description>Abase for other temporary directories.</description>

   </property>

   <property>

        <name>fs.default.name</name>

        <value>hdfs://192.168.137.94:9000</value>

   </property>

</configuration>
B. 修改hadoop-env.sh

         修改/opt/hadoop/hadoop-2.8.0/etc/hadoop/hadoop-env.sh文件

         将export   JAVA_HOME=${JAVA_HOME}

         修改为:

         export JAVA_HOME=/usr/java/jdk1.7.0_79

        说明:修改为自己的JDK路径
C. 修改hdfs-site.xml

          修改/opt/hadoop/hadoop-2.8.0/etc/hadoop/hdfs-site.xml文件

          在<configuration>节点内加入配置:

<property>

   <name>dfs.name.dir</name>

   <value>/root/hadoop/dfs/name</value>

   <description>Path on the local filesystem where theNameNode stores the namespace and transactions logs persistently.</description>

</property>

<property>

   <name>dfs.data.dir</name>

   <value>/root/hadoop/dfs/data</value>

   <description>Comma separated list of paths on the localfilesystem of a DataNode where it should store its blocks.</description>

</property>

<property>

   <name>dfs.replication</name>

   <value>2</value>

</property>

<property>

      <name>dfs.permissions</name>

      <value>false</value>

      <description>need not permissions</description>

</property>

          说明:dfs.permissions配置为false后,可以允许不要检查权限就生成dfs上的文件,方便倒是方便了,但是你需要防止误删除,请将它设置为true,或者直接将该property节点删除,因为默认就是true。

D.新建并且修改mapred-site.xml

           在该版本中,有一个名为mapred-site.xml.template的文件,复制该文件,然后改名为mapred-site.xml,

<property>

    <name>mapred.job.tracker</name>

    <value>192.168.137.94:9001</value>

</property>

<property>

      <name>mapred.local.dir</name>

       <value>/root/hadoop/var</value>

</property>

<property>

       <name>mapreduce.framework.name</name>

       <value>yarn</value>

</property>
E.修改slaves文件

         修改/opt/hadoop/hadoop-2.8.0/etc/hadoop/slaves文件,将里面的localhost删除,添加如下内容:

192.168.137.120

192.168.137.183

 

F. 修改yarn-site.xml文件

         修改/opt/hadoop/hadoop-2.8.0/etc/hadoop/yarn-site.xml文件,

         在<configuration>节点内加入配置(注意了,内存根据机器配置越大越好,我这里只配2个G是因为机器不行):

<property>

        <name>yarn.resourcemanager.hostname</name>

        <value>192.168.137.94</value>

   </property>

   <property>

        <description>The address of the applications manager interface in the RM.</description>

        <name>yarn.resourcemanager.address</name>

        <value>${yarn.resourcemanager.hostname}:8032</value>

   </property>

   <property>

        <description>The address of the scheduler interface.</description>

        <name>yarn.resourcemanager.scheduler.address</name>

        <value>${yarn.resourcemanager.hostname}:8030</value>

   </property>

   <property>

        <description>The http address of the RM web application.</description>

        <name>yarn.resourcemanager.webapp.address</name>

        <value>${yarn.resourcemanager.hostname}:8088</value>

   </property>

   <property>

        <description>The https adddress of the RM web application.</description>

        <name>yarn.resourcemanager.webapp.https.address</name>

        <value>${yarn.resourcemanager.hostname}:8090</value>

   </property>

   <property>

        <name>yarn.resourcemanager.resource-tracker.address</name>

        <value>${yarn.resourcemanager.hostname}:8031</value>

   </property>

   <property>

        <description>The address of the RM admin interface.</description>

        <name>yarn.resourcemanager.admin.address</name>

        <value>${yarn.resourcemanager.hostname}:8033</value>

   </property>

   <property>

        <name>yarn.nodemanager.aux-services</name>

        <value>mapreduce_shuffle</value>

   </property>

   <property>

        <name>yarn.scheduler.maximum-allocation-mb</name>

        <value>2048</value>

        <discription>每个节点可用内存,单位MB,默认8182MB</discription>

   </property>

   <property>

        <name>yarn.nodemanager.vmem-pmem-ratio</name>

        <value>2.1</value>

   </property>

   <property>

        <name>yarn.nodemanager.resource.memory-mb</name>

        <value>2048</value>

</property>

   <property>

        <name>yarn.nodemanager.vmem-check-enabled</name>

        <value>false</value>

</property>

       说明:yarn.nodemanager.vmem-check-enabled这个的意思是忽略虚拟内存的检查,如果你是安装在虚拟机上,这个配置很有用,配上去之后后续操作不容易出问题。如果是实体机上,并且内存够多,可以将这个配置去掉。

www.htsjk.Com true http://www.htsjk.com/Hadoop/37397.html NewsArticle Hadoop, ?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 Licen...
相关文章
    暂无相关文章
评论暂时关闭