我爱编程

hadoop 分布式环境搭建

2018-04-29  本文已影响0人  Jason_M_Ho

准备

搭建分布式系统需要多台虚拟机

修改主机名

SSH 无密码验证

安装 JDK

hadoop 集群安装

<configuration>
<property>
     <name>fs.defaultFS</name>
     <value>hdfs://jason:9000</value>
</property>
<property>
    <name>io.file.buffer.size</name>
    <value>131072</value>
</property>
<property>
    <name>hadoop.tmp.dir</name>
    <value>file:/home/jason/hadoop/tmp</value>
    <description>Abasefor other temporary directories.</description>
</property>
<property>
   <name>hadoop.native.lib</name>
   <value>true</value>
   <description>Should native hadoop libraries, if present, be used.</description>
</property> 
</configuration>

<configuration>
<property>
    <name>dfs.namenode.secondary.http-address</name>
    <value>jason:9001</value>
</property>

<property>
    <name>dfs.namenode.name.dir</name>
    <value>file:/home/jason/hadoop/dfs/name</value>
</property>

<property>
    <name>dfs.datanode.data.dir</name>
    <value> file:/home/jason/hadoop/dfs/data</value>
</property>

<property>
    <name>dfs.replication</name>
    <value>2</value>
</property>

<property>
    <name>dfs.webhdfs.enabled</name>
    <value>true</value>
</property>
</configuration>

<configuration>
<property>
    <name>mapreduce.framework.name</name>
    <value>yarn</value>
</property>
<property>
    <name>mapreduce.jobhistory.address</name>
    <value>jason:10020</value>
</property>
<property>
    <name>mapreduce.jobhistory.webapp.address</name>
    <value> jason:19888</value>
</property>
</configuration>

<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>
 <property>
      <name>yarn.resourcemanager.address</name>
      <value>jason:8032</value>
 </property>
 <property>
     <name>yarn.resourcemanager.scheduler.address</name>
     <value>jason:8030</value>
 </property>
 <property>
      <name>yarn.resourcemanager.resource-tracker.address</name>
      <value>jason:8035</value>
 </property>
  <property>
      <name>yarn.resourcemanager.admin.address</name>
      <value>jason:8033</value>
 </property>
 <property>
      <name>yarn.resourcemanager.webapp.address</name>
      <value>jason:8088</value>
 </property>

</configuration>


验证安装

运行 wordcount 程序

wordcount 程序由 hadoop 提供,位于share/hadoop/mapreduce/hadoop-mapreduce-examples-2.6.0.jar内。

上一篇下一篇

猜你喜欢

热点阅读