设为首页收藏本站

IT联盟

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 1256|回复: 1

[学习笔记] Hadoop2搭建与配置详解

[复制链接]

232

主题

242

帖子

3605

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
3605

管理员最佳新人活跃会员热心会员推广达人灌水之王突出贡献优秀版主荣誉管理论坛元老

发表于 2018-7-9 22:14:56 | 显示全部楼层 |阅读模式
Hadoop源码包下载
http://mirror.bit.edu.cn/apache/hadoop/common
1. 集群环境
Master 192.168.2.100
Slave1 192.168.2.101
Slave2 192.168.2.102
2. 下载安装包
#Master
wgethttp://mirrors.shu.edu.cn/apache/hadoop/common/hadoop-2.8.4/hadoop-2.8.4.tar.gz
tar zxvf hadoop-2.8.4.tar.gz
3. 修改Hadoop配置文件
#Master
cd hadoop-2.8.4/etc/hadoop
vim hadoop-env.sh
export JAVA_HOME=/usr/local/src/jdk1.8.0_152
vim yarn-env.sh
export JAVA_HOME=/usr/local/src/jdk1.8.0_152
vim slaves
slave1
slave2
vim core-site.xml
[AppleScript] 纯文本查看 复制代码
<configuration>
        <property>
                <name>fs.defaultFS</name>
                <value>hdfs://master:9000</value>
        </property>
        <property>
                <name>hadoop.tmp.dir</name>
                <value>file:/usr/local/hadoop-2.8.4/tmp</value>
        </property>
</configuration>

vim hdfs-site.xml
[AppleScript] 纯文本查看 复制代码
<configuration>
        <property>
                <name>dfs.namenode.secondary.http-address</name>
                <value>master:9001</value>
        </property>
        <property>
                <name>dfs.namenode.name.dir</name>
                <value>file:/usr/local/hadoop-2.8.4/dfs/name</value>
        </property>
        <property>
                <name>dfs.datanode.data.dir</name>
                <value>file:/usr/local/hadoop-2.8.4/dfs/data</value>
        </property>
        <property>
                <name>dfs.repliction</name>
                <value>3</value>
        </property>
</configuration>


vim mapred-site.xml
[AppleScript] 纯文本查看 复制代码
<configuration>
         <property>
                  <name>mapreduce.framework.name</name>
                  <value>yarn</value>
         </property>
</configuration>

vim yarn-site.xml
[AppleScript] 纯文本查看 复制代码
<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>master:8032</value>
         </property>
         <property>
                  <name>yarn.resourcemanager.scheduler.address</name>
                  <value>master:8030</value>
         </property>
         <property>
                  <name>yarn.resourcemanager.resource-tracker.address</name>
                  <value>master:8035</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>
#创建临时目录和文件目录
mkdir /usr/local/hadoop-2.8.4/tmp
mkdir -p /usr/local/hadoop-2.8.4/dfs/name
mkdir -p /usr/local/hadoop-2.8.4/dfs/data
4. 配置环境变量
#Master、Slave1、Slave2
vim ~/.bashrc
HADOOP_HOME=/usr/local/hadoop-2.8.4
export PATH=$PATHHADOOP_HOME/bin
#刷新环境变量
source ~/.bashrc
5. 拷贝安装包
#Master
scp -r /usr/local/src/hadoop-2.8.4 root@slave1:/usr/local/src/hadoop-2.8.4
scp -r /usr/local/src/hadoop-2.8.4 root@slave2:/usr/local/src/hadoop-2.8.4
6. 启动集群
#Master
#初始化Namenode
hadoop namenode -format

#启动集群
./sbin/start-all.sh
6. 集群状态
jps
#Master

#Slave1

#Slave2


7.监控网页
http://master:8088

8. 测试

9. 关闭集群
./sbin/hadoop stop-all.sh


您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|IT技术联盟论坛 ( 京ICP备15062632  点击这里给我发消息

GMT+8, 2019-12-15 14:13 , Processed in 0.084057 second(s), 25 queries .

Powered by Discuz! X3.2 Licensed Designed By

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表