登录  
 加关注
查看详情
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

fyzjhh的博客

データベース管理者 の ブログ 、江です

 
 
 

日志

 
 

hadoop 2.2.0 HA和Federation  

2014-05-21 17:51:02|  分类: hadoop |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

参考url

http://www.cnblogs.com/junrong624/p/3580477.html
http://blog.csdn.net/aaronhadoop/article/details/24859369

https://hadoop.apache.org/docs/r2.2.0/hadoop-yarn/hadoop-yarn-site/HDFSHighAvailabilityWithNFS.html#Deployment
http://hadoop.apache.org/docs/r2.2.0/hadoop-project-dist/hadoop-hdfs/Federation.html#HDFS_Federation


机器
namenode 0 1 3 4
datanode 1 3 4 
journalnode 0 1 3 
zookeeper 0 1 3
zkfc 0 1 3 4


zookeeper 配置


hadoop 配置

core-site.xml
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://cluster1</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/home/admin/jhh/hadoop/hadoop2data/tmp</value>
</property>
<property>
<name>ha.zookeeper.quorum</name>
<value>os-0:2181,os-1:2181,os-3:2181</value>
</property>
</configuration>


hdfs-site.xml
<configuration>

<property>
<name>dfs.namenode.name.dir</name>
<value>/home/admin/jhh/hadoop/hadoop2data/name</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>/home/admin/jhh/hadoop/hadoop2data/data</value>
</property>
<property>
<name>dfs.permissions</name>
<value>false</value>
</property>

<property>
<name>dfs.replication</name>
<value>2</value>
</property>
<property>
<name>dfs.nameservices</name>
<value>cluster1,cluster2</value>
</property>
<property>

<!--描述cluster1集群的信息-->
<name>dfs.ha.namenodes.cluster1</name>
<value>os-0,os-1</value>
</property>
<property>
<name>dfs.namenode.rpc-address.cluster1.os-0</name>
<value>os-0:9000</value>
</property>
<property>
<name>dfs.namenode.http-address.cluster1.os-0</name>
<value>os-0:50070</value>
</property>
<property>
<name>dfs.namenode.rpc-address.cluster1.os-1</name>
<value>os-1:9000</value>
</property>
<property>
<name>dfs.namenode.http-address.cluster1.os-1</name>
<value>os-1:50070</value>
</property>
<property>
<name>dfs.ha.automatic-failover.enabled.cluster1</name>
<value>true</value>
</property>
<property>
<name>dfs.client.failover.proxy.provider.cluster1</name>       
<value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value>
</property>

<!-- 在cluster1中,qjournal后面写cluster1 , 在cluster2中,qjournal后面写cluster2,并且其他的cluster需要注释掉 -->

<!-- 
<property>
<name>dfs.namenode.shared.edits.dir</name>
<value>qjournal://os-0:8485;os-1:8485;os-3:8485/cluster1</value>
<description>指定cluster的两个NameNode共享edits文件目录时,使用的是JournalNode集群来维护</description>
</property>
-->


<!--描述cluster2集群的信息-->
<property>
<name>dfs.ha.namenodes.cluster2</name>
<value>os-3,os-4</value>
</property>
<property>
<name>dfs.namenode.rpc-address.cluster2.os-3</name>
<value>os-3:9000</value>
</property>
<property>
<name>dfs.namenode.http-address.cluster2.os-3</name>
<value>os-3:50070</value>
</property>
<property>
<name>dfs.namenode.rpc-address.cluster2.os-4</name>
<value>os-4:9000</value>
</property>
<property>
<name>dfs.namenode.http-address.cluster2.os-4</name>
<value>os-4:50070</value>
</property>

<property>
<name>dfs.ha.automatic-failover.enabled.cluster2</name>
<value>true</value>
</property>
<property>
<name>dfs.client.failover.proxy.provider.cluster2</name>
<value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value>
</property>

<!-- 在cluster1中,qjournal后面写cluster1 , 在cluster2中,qjournal后面写cluster2,并且其他的cluster需要注释掉 -->

<!-- 
<property>
<name>dfs.namenode.shared.edits.dir</name>
<value>qjournal://os-0:8485;os-1:8485;os-3:8485/cluster2</value>
<description>指定cluster的两个NameNode共享edits文件目录时,使用的是JournalNode集群来维护</description>
</property>
-->

<!--配置cluster1、cluster2公共的信息--> 
<property>
<name>dfs.journalnode.edits.dir</name>
<value>/home/admin/jhh/hadoop/hadoop2data/journal</value>
</property>
<property>
<name>dfs.ha.fencing.methods</name>
<value>sshfence</value>
</property>
<property>
<name>dfs.ha.fencing.ssh.private-key-files</name>
<value>/root/.ssh/id_rsa</value>
</property>
</configuration>



启动hdfs

for i in 0 1 3 4 ; do echo $i=== ; ssh os-$i " jps " ; done 
for i in 0 1 3  ; do echo $i=== ; ssh os-$i " cd ~/jhh/zookeeper/zookeeper-3.4.5 ; ./bin/zkServer.sh status " ; done 
for i in 0 1 3  ; do echo $i=== ; ssh os-$i " cd ~/jhh/hadoop/hadoop-2.2.0 ; ./sbin/hadoop-daemon.sh start journalnode " ; done 

format zk
0 3
./bin/hdfs  zkfc -formatZK


format namenode , start namenode and zkfc
0 3
./bin/hdfs  namenode -format
./sbin/hadoop-daemon.sh  start namenode

1 4
./bin/hdfs  namenode -bootstrapStandby
./sbin/hadoop-daemon.sh  start namenode

0 1 3 4
./sbin/hadoop-daemon.sh start zkfc 

启动datanode
0
./sbin/hadoop-daemons.sh   start  datanode

查看namenode信息

NameNode 'os-0:9000' (active)

Started: Thu May 22 19:17:56 CST 2014
Version: 2.2.0, 1529768
Compiled: 2013-10-07T06:28Z by hortonmu from branch-2.2.0
Cluster ID: CID-4a3dd0b9-6cab-40f4-ae78-d1f2ea437c49
Block Pool ID: BP-120728876-192.168.12.220-1400757450392

NameNode 'os-1:9000' (standby)

Started: Thu May 22 19:19:41 CST 2014
Version: 2.2.0, 1529768
Compiled: 2013-10-07T06:28Z by hortonmu from branch-2.2.0
Cluster ID: CID-4a3dd0b9-6cab-40f4-ae78-d1f2ea437c49
Block Pool ID: BP-120728876-192.168.12.220-1400757450392

NameNode 'os-3:9000' (standby)

Started: Thu May 22 19:24:02 CST 2014
Version: 2.2.0, 1529768
Compiled: 2013-10-07T06:28Z by hortonmu from branch-2.2.0
Cluster ID: CID-ad160e8d-1ba0-412c-82c3-3febda660f7a
Block Pool ID: BP-423966402-192.168.12.223-1400757836440

NameNode 'os-4:9000' (active)

Started: Thu May 22 19:26:29 CST 2014
Version: 2.2.0, 1529768
Compiled: 2013-10-07T06:28Z by hortonmu from branch-2.2.0
Cluster ID: CID-ad160e8d-1ba0-412c-82c3-3febda660f7a
Block Pool ID: BP-423966402-192.168.12.223-1400757836440


mapred-site.xml
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>


yarn-site.xml

<configuration>
<property>
<name>yarn.resourcemanager.connect.retry-interval.ms</name>
<value>2000</value>
</property>

<property>
<name>yarn.resourcemanager.ha.enabled</name>
<value>true</value>
</property>
<property>
<name>yarn.resourcemanager.ha.automatic-failover.enabled</name>
<value>true</value>
</property>
<property>
<name>yarn.resourcemanager.ha.rm-ids</name>
<value>rm1,rm2</value>
</property>

<property>
<name>yarn.resourcemanager.ha.id</name>
<value>rm1</value> <!-- 注释, rm1上配置为rm1, rm2上配置rm2-->
</property>

<!-- hadoop 2.2.0 中没有ZKRMStateStore ,可以用FileSystemRMStateStore-->

<property>
<name>yarn.resourcemanager.store.class</name>
<value>org.apache.hadoop.yarn.server.resourcemanager.recovery.FileSystemRMStateStore</value>
</property>
<property>
<name>yarn.resourcemanager.fs.state-store.uri</name>
<value>hdfs://cluster1/rmstore</value>
</property>

<!-- 如果有ZKRMStateStore,请使用这个store
<name>yarn.resourcemanager.store.class</name>
<value>org.apache.hadoop.yarn.server.resourcemanager.recovery.ZKRMStateStore</value>
</property>
<property>
<name>yarn.resourcemanager.zk.state-store.address</name>
<value>os-0:2181,os-1:2181,os-3:2181</value>
</property>
<property>
<name>ha.zookeeper.quorum</name>
<value>os-0:2181,os-1:2181,os-3:2181</value>
</property>
-->

<property>
<name>yarn.resourcemanager.recovery.enabled</name>
<value>true</value>
</property>
<property>
<name>yarn.app.mapreduce.am.scheduler.connection.wait.interval-ms</name>
<value>5000</value>
</property>

<!-- RM1 configs -->
<property>
<name>yarn.resourcemanager.address.rm1</name>
<value>os-0:23140</value>
</property>
<property>
<name>yarn.resourcemanager.scheduler.address.rm1</name>
<value>os-0:23130</value>
</property>
<property>
<name>yarn.resourcemanager.webapp.address.rm1</name>
<value>os-0:23188</value>
</property>
<property>
<name>yarn.resourcemanager.resource-tracker.address.rm1</name>
<value>os-0:23125</value>
</property>
<property>
<name>yarn.resourcemanager.admin.address.rm1</name>
<value>os-0:23141</value>
</property>
<property>
<name>yarn.resourcemanager.ha.admin.address.rm1</name>
<value>os-0:23142</value>
</property>

<!-- RM2 configs -->
<property>
<name>yarn.resourcemanager.address.rm2</name>
<value>os-1:23140</value>
</property>
<property>
<name>yarn.resourcemanager.scheduler.address.rm2</name>
<value>os-1:23130</value>
</property>
<property>
<name>yarn.resourcemanager.webapp.address.rm2</name>
<value>os-1:23188</value>
</property>
<property>
<name>yarn.resourcemanager.resource-tracker.address.rm2</name>
<value>os-1:23125</value>
</property>
<property>
<name>yarn.resourcemanager.admin.address.rm2</name>
<value>os-1:23141</value>
</property>
<property>
<name>yarn.resourcemanager.ha.admin.address.rm2</name>
<value>os-1:23142</value>
</property>
 
<!-- Node Manager Configs -->
<property>
<description>Address where the localizer IPC is.</description>
<name>yarn.nodemanager.localizer.address</name>
<value>0.0.0.0:23344</value>
</property>
<property>
<description>NM Webapp address.</description>
<name>yarn.nodemanager.webapp.address</name>
<value>0.0.0.0:23999</value>
</property>
<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.nodemanager.local-dirs</name>
<value>/tmp/pseudo-dist/yarn/local</value>
</property>
<property>
<name>yarn.nodemanager.log-dirs</name>
<value>/tmp/pseudo-dist/yarn/log</value>
</property>
<property>
<name>mapreduce.shuffle.port</name>
<value>23080</value>
</property>
</configuration>


启动yarn
0
./sbin/start-yarn.sh  
1
./sbin/yarn-daemon.sh start resourcemanager

启动的端口尽量还是8088 , 不知为何


 
  评论这张
 
阅读(288)| 评论(0)

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018