首页 > 代码库 > Hadoop2.7.3分布式搭建

Hadoop2.7.3分布式搭建

一.从hadoop 下载2.7.3 安装包
版本:hadoop-2.7.3.tar.gz
下载地址:www.apache.org/dist/hadoop/common/hadoop-2.7.3/hadoop-2.7.3.tar.gz
百度云下载地址:
http://pan.baidu.com/s/1pLOyu9d  密码:s0j5

二. 解压下载好的hadoop-2.7.3.tar.gz到/usr/local目录下
$ sudo tar -xzvf hadoop-2.7.3.tar.gz
技术分享
 可以得到hadoop-2.7.3目录

三.hadoop配置
3.1 hadoop-env.sh
# cd /hadoop-2.7.3/etc/hadoop/
# sudo vim hadoop-env.sh
修改export JAVA_HOME=/usr/local/jdk1.8
技术分享
yarn-env.sh (同上)
mapred-env.sh (同上)
3.2  slaves
   删除 localhost
   添加 
   hadoop1
   hadoop2
   技术分享
 
3.2 core-site.xml
  1. <configuration>
  2. <property>
  3. <name>fs.default.name</name>
  4. <value>hdfs://hadoop0:9000</value>
  5. </property>
  6. <property>
  7. <name>hadoop.tmp.dir</name>
  8. <value>file:/usr/local/hadoop-2.7.3/tmp</value>
  9. </property>
  10. </configuration>


3.3 hdfs-site.xml         
  1. <configuration>
  2. <property>
  3. <name>dfs.datanode.data.dir</name>
  4. <value>/usr/local/hadoop-2.7.3/hdf/data</value>
  5. <final>true</final>
  6. </property>
  7. <property>
  8. <name>dfs.namenode.name.dir</name>
  9. <value>/usr/local/hadoop-2.7.3/hdf/name</value>
  10. <final>true</final>
  11. </property>
  12. </configuration>


3.4 mapred-site.xml   
  1. <configuration>
  2. <property>
  3. <name>mapreduce.framework.name</name>
  4. <value>yarn</value>
  5. </property>
  6. <property>
  7. <name>mapreduce.jobhistory.address</name>
  8. <value>hadoop0:10020</value>
  9. </property>
  10. <property>
  11. <name>mapreduce.jobhistory.webapp.address</name>
  12. <value>hadoop0:19888</value>
  13. </property>
  14. </configuration>

3.5 yarn-site.xml

  1. <configuration>
  2. <property>
  3. <name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>
  4. <value>org.apache.hadoop.mapred.ShuffleHandler</value>
  5. </property>
  6. <property>
  7. <name>yarn.resourcemanager.address</name>
  8. <value>hadoop0:8032</value>
  9. </property>
  10. <property>
  11. <name>yarn.resourcemanager.scheduler.address</name>
  12. <value>hadoop0:8030</value>
  13. </property>
  14. <property>
  15. <name>yarn.resourcemanager.resource-tracker.address</name>
  16. <value>hadoop0:8031</value>
  17. </property>
  18. <property>
  19. <name>yarn.resourcemanager.admin.address</name>
  20. <value>hadoop0:8033</value>
  21. </property>
  22. <property>
  23. <name>yarn.resourcemanager.webapp.address</name>
  24. <value>hadoop0:8088</value>
  25. </property>
  26. </configuration>


四. 各个主机之间复制hadoop
    # sudo scp -r /usr/local/hadoop-2.7.3 hadoop1:/usr/local/
    # sudo scp -r /usr/local/hadoop-2.7.3 hadoop2:/usr/local/

五. 各个主机之间hadoop环境变量
   5.1 # sudo vim /etc/profile
   编辑内容:
  1. export HADOOP_HOME=/usr/local/hadoop-2.7.3
  2. export PATH=$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$PATH
  3. export HADOOP_LOG_DIR=/usr/local/hadoop-2.7.3/logs
  4. export YARN_LOG_DIR=$HADOOP_LOG_DIR


    5.2 使配置生效
     # source /etc/profile

六 . 格式化namenode(在master上执行)
         # cd /usr/local/hadoop-2.7.3/bin
         # hdfs namenode -format
         技术分享
 
   
七. 启动 hadoop
    # cd /usr/local/hadoop-2.7.3/sbin
    # start-all.sh

master:
 技术分享
slave1:
 技术分享
slave2:
 技术分享
 http://192.168.1.111:50070/

技术分享
 
http://192.168.1.111:8088/cluster

技术分享

后续集成zookeeper,hbase等

http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.9/

www.apache.org/dist/hbase/1.2.4/hbase-1.2.4-bin.tar.gz









来自为知笔记(Wiz)


Hadoop2.7.3分布式搭建