目录
6.hadoop02,hadoop03重复3-5的步骤配置就可以
2.关闭nodemanager 、resourcemanager和historymanager
3. 启动nodemanager 、resourcemanager和historymanager
在这里hadoop-2.7.3.tar.gz,官网下载
[root@hadoop01 software]# ls
hadoop-2.7.3.tar.gz
[root@hadoop01 software]# tar -zxvf hadoop-2.7.3.tar.gz -C /opt/module/
在esc状态下:set nu显示行号
打开hadoop-env.sh修改jdk路径
[root@hadoop01 ~]# cd /opt/module/hadoop-2.7.3/etc/hadoop
[root@hadoop01 hadoop]# vim hadoop-env.sh
25 export JAVA_HOME=/opt/module/jdk1.8.0_144
[root@hadoop01 hadoop]# vim /etc/profile #最后一行添加
export HADOOP_HOME=/opt/module/hadoop-2.7.3
export PATH=$PATH:$HADOOP_HOME/bin
export PATH=$PATH:$HADOOP_HOME/sbin
[root@hadoop01 software]# source /etc/profile
[root@hadoop01 ~]# cd .ssh
[root@hadoop01 .ssh]# pwd
/root/.ssh
[root@hadoop01 .ssh]# ssh-keygen -t rsa
[root@hadoop01 .ssh]# ssh-copy-id hadoop01 #yes回车,输入密码
[root@hadoop01 .ssh]# ssh-copy-id hadoop02
[root@hadoop01 .ssh]# ssh-copy-id hadoop03
[root@hadoop01 .ssh]# ssh-copy-id localhost
[root@hadoop01 ~]# mkdir bin
[root@hadoop01 bin]# touch xsync
[root@hadoop01 bin]# vim xsync
#!/bin/bash
#1 获取输入参数个数,如果没有参数,直接退出
pcount=$#
if((pcount==0)); then
echo no args;
exit;
fi
#2 获取文件名称
p1=$1
fname=`basename $p1`
echo fname=$fname
#3 获取上级目录到绝对路径
pdir=`cd -P $(dirname $p1); pwd`
echo pdir=$pdir
#4 获取当前用户名称
user=`whoami`
#5 循环
for((host=1; host<4; host++)); do
#echo $pdir/$fname $user@hadoop$host:$pdir
echo --------------- hadoop0$host ----------------
rsync -rvl $pdir/$fname $user@hadoop0$host:$pdir
done
[root@hadoop01 bin]# chmod 777 xsync
[root@hadoop01 bin]# /root/bin/xsync /root/bin
[root@hadoop01 hadoop]# vim core-site.xml
fs.defaultFS
hdfs://hadoop01:9000
hadoop.tmp.dir
/opt/module/hadoop-2.7.3/data/tmp
~
[root@hadoop01 hadoop]# vim hdfs-site.xml
dfs.replication
3
dfs.namenode.secondary.http-address
hadoop01:50090
[root@hadoop01 hadoop]# vim slaves
hadoop01
hadoop02
hadoop03
[root@hadoop01 hadoop]# vim yarn-env.sh
23 export JAVA_HOME=/opt/module/jdk1.8.0_144
[root@hadoop01 hadoop]# vim yarn-site.xml
yarn.nodemanager.aux-services
mapreduce_shuffle
yarn.resourcemanager.hostname
hadoop01
yarn.log-aggregation-enable
true
yarn.log-aggregation.retain-seconds
604800
[root@hadoop01 hadoop]# vim mapred-env.sh
export JAVA_HOME=/opt/module/jdk1.8.0_144
export HADOOP_JOB_HISTORYSERVER_HEAPSIZE=1000
export HADOOP_MAPRED_ROOT_LOGGER=INFO,RFA
[root@hadoop01 hadoop]# mv mapred-site.xml.template mapred-site.xml #修改名字
[root@hadoop01 hadoop]# vim mapred-site.xml
mapreduce.framework.name
yarn
mapreduce.jobhistory.address
hadoop01:10020
mapreduce.jobhistory.webapp.address
hadoop01:19888
[root@hadoop01 hadoop]# /root/bin/xsync /opt/module/hadoop-2.7.3/
[root@hadoop01 hadoop-2.7.3]# bin/hdfs namenode -format
[root@hadoop01 hadoop-2.7.3]# sbin/start-dfs.sh
[root@hadoop01 hadoop-2.7.3]# jps
10496 Jps
28469 SecondaryNameNode
28189 NameNode
28286 DataNode
[root@hadoop02 ~]# jps
27242 Jps
3614 DataNode
[root@hadoop03 ~]# jps
27242 Jps
3614 DataNode

[root@hadoop01 hadoop-2.7.3]# sbin/start-yarn.sh
[root@hadoop01 hadoop-2.7.3]# jps
49155 NodeManager
28469 SecondaryNameNode
48917 ResourceManager
10600 Jps
28189 NameNode
28286 DataNode
[root@hadoop02 ~]# jps
3736 NodeManager
27242 Jps
3614 DataNode
[root@hadoop03 ~]# jps
3736 NodeManager
27242 Jps
3614 DataNode


# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
# 最后一行添加
192.168.86.101 hadoop01
192.168.86.102 hadoop02
192.168.86.103 hadoop03
[root@hadoop01 ~]# mkdir /mnt/cdrom
[root@hadoop01 ~]# cd /mnt
[root@hadoop01 mnt]# ll
total 4
dr-xr-xr-x. 7 root root 4096 May 23 2016 cdrom
[root@hadoop01 mnt]# mount -t auto /dev/cdrom /mnt/cdrom
[root@hadoop01 mnt]# cd /etc/yum.repos.d/
[root@hadoop01 yum.repos.d]# mkdir bak
[root@hadoop01 yum.repos.d]# mv CentOS-* bak
[root@hadoop01 yum.repos.d]# touch CentOS-DVD.repo
[root@hadoop01 yum.repos.d]# vim CentOS-DVD.repo
[centos6-dvd]
name=Welcome to local source yum
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0
[root@hadoop01 yum.repos.d]# yum clean all
[root@hadoop01 yum.repos.d]# yum repolist all
[root@hadoop01 hadoop]# vim mapred-site.xml
mapreduce.framework.name
yarn
mapreduce.jobhistory.address
hadoop01:10020
mapreduce.jobhistory.webapp.address
hadoop01:19888
[root@hadoop01 hadoop-2.7.3]# ls sbin/ | grep mr
mr-jobhistory-daemon.sh
[root@hadoop01 hadoop-2.7.2]$ sbin/mr-jobhistory-daemon.sh start historyserver
[root@hadoop01 hadoop-2.7.2]$ jps
http://hadoop01:19888/jobhistory
[root@hadoop01 hadoop]# vim yarn-site.xml
yarn.nodemanager.aux-services
mapreduce_shuffle
yarn.resourcemanager.hostname
hadoop01
yarn.log-aggregation-enable
true
yarn.log-aggregation.retain-seconds
604800
[root@hadoop01 hadoop-2.7.3]$ sbin/yarn-daemon.sh stop resourcemanager
[root@hadoop01 hadoop-2.7.3]$ sbin/yarn-daemon.sh stop nodemanager
[root@hadoop01 hadoop-2.7.3]$ sbin/mr-jobhistory-daemon.sh stop historyserver
[root@hadoop01 hadoop-2.7.3]$ sbin/yarn-daemon.sh start resourcemanager
[root@hadoop01 hadoop-2.7.3]$ sbin/yarn-daemon.sh start nodemanager
[root@hadoop01 hadoop-2.7.3]$ sbin/mr-jobhistory-daemon.sh start historyserver
[root@hadoop01 hadoop-2.7.3]$ bin/hdfs dfs -rm -R /user/root/output
[root@hadoop01 hadoop-2.7.3]$ hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.3.jar wordcount /user/root/input /user/root/output
