0. Hadoop源码包下载
http://mirror.bit.edu.cn/apache/hadoop/common
1. 集群环境
Master 172.16.11.97
Slave1 172.16.11.98
Slave2 172.16.11.99
2. 下载安装包
#Master
wget http://mirror.bit.edu.cn/apache/hadoop/common/hadoop-2.8.2/hadoop-2.8.2.tar.gz
tar zxvf hadoop-2.8.2.tar.gz
3. 修改Hadoop配置文件
#Master
cd hadoop-2.8.2/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
fs.defaultFS
hdfs://172.16.11.97:9000
hadoop.tmp.dir
file:/usr/local/src/hadoop-2.8.2/tmp
vim hdfs-site.xml
dfs.namenode.secondary.http-address
master:9001
dfs.namenode.name.dir
file:/usr/local/src/hadoop-2.8.2/dfs/name
dfs.datanode.data.dir
file:/usr/local/src/hadoop-2.8.2/dfs/data
dfs.repliction
3
vim mapred-site.xml
mapreduce.framework.name
yarn
vim yarn-site.xml
yarn.nodemanager.aux-services
mapreduce_shuffle
yarn.nodemanager.aux-services.mapreduce.shuffle.class
org.apache.hadoop.mapred.ShuffleHandler
yarn.resourcemanager.address
master:8032
yarn.resourcemanager.scheduler.address
master:8030
yarn.resourcemanager.resource-tracker.address
master:8035
yarn.resourcemanager.admin.address
master:8033
yarn.resourcemanager.webapp.address
master:8088
#创建临时目录和文件目录
mkdir /usr/local/src/hadoop-2.8.2/tmp
mkdir -p /usr/local/src/hadoop-2.8.2/dfs/name
mkdir -p /usr/local/src/hadoop-2.8.2/dfs/data
4.
配置环境变量
#Master、Slave1、Slave2
vim ~/.bashrc
HADOOP_HOME=/usr/local/src/hadoop-2.8.2
export PATH=$PATH:$HADOOP_HOME/bin
#刷新环境变量
source ~/.bashrc
5. 拷贝安装包
#
Master
scp -r
/usr/local/src/hadoop-2.8.2
root@slave1:
/usr/local/src/hadoop-2.8.2
scp -r
/usr/local/src/hadoop-2.8.2
root@slave2:
/usr/local/src/hadoop-2.8.2
6. 启动集群
#Master
#初始化Namenode
hadoop namenode -format
#启动集群
./sbin/start-all.sh
6. 集群状态
jps
#Master
#Slave1
#Slave2
7.监控网页
http://master:8088
8. 操作命令
#和Hadoop1.0操作命令是一样的
9. 关闭集群
./sbin/hadoop stop-all.sh