3. 安装配置Hadoop2.2.0
假定各node角色划分如下:
hdp-server-01 resourcemanager, nodemanager, proxyserver,historyserver, datanode, namenode
hdp-server-02 datanode, nodemanager
hdp-server-03 datanode, nodemanager
a. 目录准备
mkdir -p ~/yarn_data/tmp
mkdir -p ~/yarn_data/mapred
b. 配置环境变量(追加至~/.bashrc)
#hadoop env
export HADOOP_HOME="$HOME/hadoop-2.2.0"
export HADOOP_PREFIX="$HADOOP_HOME/"
export YARN_HOME=$HADOOP_HOME
export HADOOP_MAPRED_HOME="$HADOOP_HOME"
export HADOOP_COMMON_HOME="$HADOOP_HOME"
export HADOOP_HDFS_HOME="$HADOOP_HOME"
export HADOOP_CONF_DIR="$HADOOP_HOME/etc/hadoop/"
export YARN_CONF_DIR=$HADOOP_CONF_DIR
export PATH="$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$PATH"
c. 修改官方启动脚本
$ cd $YARN_HOME/libexec/
$ vim hadoop-config.sh
#修改第96行代码为:
export HADOOP_SLAVES="${HADOOP_CONF_DIR}/$1"
#保存退出vim
d. 设置配置文件
<!-- $YARN_HOME/etc/hadoop/core-site.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://www.linuxidc.com/configuration.xsl"?>
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://hdp-server-01:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/home/yarn/yarn_data/tmp/hadoop-grid</value>
</property>
</configuration>
<!-- $YARN_HOME/etc/hadoop/hdfs-site.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://www.linuxidc.com/configuration.xsl"?>
<configuration>
<property>
<name>dfs.replication</name>
<value>3</value>
</property>
</configuration>
<!-- $YARN_HOME/etc/hadoop/yarn-site.xml -->
<?xml version="1.0"?>
<configuration>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.resourcemanager.address</name>
<value>hdp-server-01:8032</value>
</property>
<property>
<name>yarn.resourcemanager.resource-tracker.address</name>
<value>hdp-server-01:8031</value>
</property>
<property>
<name>yarn.resourcemanager.admin.address</name>
<value>hdp-server-01:8033</value>
</property>
<property>
<name>yarn.resourcemanager.scheduler.address</name>
<value>hdp-server-01:8030</value>
</property>
<property>
<name>yarn.nodemanager.loacl-dirs</name>
<value>/home/yarn/yarn_data/mapred/nodemanager</value>
<final>true</final>
</property>
<property>
<name>yarn.web-proxy.address</name>
<value>hdp-server-01:8888</value>
</property>
<property>
<name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>
<value>org.apache.hadoop.mapred.ShuffleHandler</value>
</property>
</configuration>
<!-- $YARN_HOME/etc/hadoop/mapred-site.xml -->
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="https://www.linuxidc.com/configuration.xsl"?>
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
至此,配置文件修改完毕,修改完后将 $HOME/hadoop-2.2.0 及 $HOME/yarn_data 两个文件分别拷贝至其他机器的同样位置,注意确保文件所有者为yarn。