Yarn ResourceManager高可用集群搭建

Yarn ResourceManager高可用集群搭建_第1张图片

配置在Zookeeper之上,进行故障转移

Yarn ResourceManager高可用集群搭建_第2张图片

单节点低可用配置:

进入mapred-site.xml添加

        mapreduce.framework.name

        yarn

进入 yarn-site.xml添加

    

        yarn.nodemanager.aux-services

        mapreduce_shuffle

    

高可用配置:

进入yarn-site.xml添加

   yarn.resourcemanager.ha.enabled

   true

   yarn.resourcemanager.cluster-id

   cluster1

   yarn.resourcemanager.ha.rm-ids

   rm1,rm2

   yarn.resourcemanager.hostname.rm1

   bigdata03

   yarn.resourcemanager.hostname.rm2

   bigdata04

   yarn.resourcemanager.zk-address

   bigdata02:2181,bigdata03:2181,bigdata04:2181

分发给其他的2、3、4机带有zookeeper的机中

scp mapred-site.xml yarn-site.xml bigdata02:`pwd`

3、4台机中进行免密钥登陆

ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa

cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

3发送密钥到4机中,并追加到authorized_keys中

scp id_dsa.pub bigdata04:`pwd`/bigdata03.pub

cat ~/.ssh/bigdata03.pub >> ~/.ssh/authorized_keys

重复上述操作,让4可以直接访问3,从而实现两者之间的免密钥登陆

先要启动zookeeper

zkServer.sh start

启动hdfs

start-dfs.sh

启动yarn

start-yarn.sh

在3、4机上启动ResourceManager

yarn-daemon.sh start resourcemanager

 

测试wordcount

cd /opt/modules/hadoop-2.6.5/share/hadoop/mapreduce

hadoop jar hadoop-mapreduce-examples-2.6.5.jar wordcount /user/root/test.txt /wordcount

注意:要保持输出路径不存在

linux中查看输出结果文件

hdfs dfs -tail /wordcount/part-r-00000

停止顺序

yarn-daemon.sh stop resourcemanager (停止resourcemanager)

stop-dfs.sh

stop-yarn.sh (停止nodemanager)

zkServer.sh stop

 

踩坑经历:shell脚本语言对格式要求真的 很严格,tab键绝不能用空格来补全

 

 

 

 

 

 

你可能感兴趣的:(大数据)