Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7162635
  • 博文数量: 3857
  • 博客积分: 6409
  • 博客等级: 准将
  • 技术积分: 15948
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-02 16:48
个人简介

迷彩 潜伏 隐蔽 伪装

文章分类

全部博文(3857)

文章存档

2017年(5)

2016年(63)

2015年(927)

2014年(677)

2013年(807)

2012年(1241)

2011年(67)

2010年(7)

2009年(36)

2008年(28)

分类: HADOOP

2015-08-25 15:16:38

HA-Federation-HDFS +Yarn集群部署方式

[日期:2015-08-25] 来源:Linux社区  作者:qiangweikang [字体:  ]

经过一下午的尝试,终于把这个集群的搭建好了,搭完感觉也没有太大的必要,就当是学习了吧,为之后搭建真实环境做基础。

以下搭建的是一个Ha-Federation-hdfs+Yarn的集群部署。

  首先讲一下我的配置:

  四个节点上的启动的分别是:

  1.linuxidc117:active namenode,

  2.linuxidc118 standby namenode ,journalnode,datanode

  3.linuxidc119 active namenode    ,journalnode,datanode

  4.linuxidc120 standby namenode ,journalnode,datanode

  这样做纯粹是因为电脑hold不住那么虚拟机了,其实这里所有的节点都应该在不同的服务器上。简单的说,就是117和119做active namenode,118和120做standby namenode,在118.119.120上分别放datanode和journalnode。

此处省略一万字,各种配置好之后。。遇到的问题和记录如下:

 1.启动 journalnode,这个journalnode话说我也不是太明白他是干嘛的~~,后续研究吧。在各个节点上启动journalnode:

[linuxidc@linuxidc118 Hadoop-2.6.0]$ sbin/hadoop-daemon.sh start journalnode
starting journalnode, logging to /home/linuxidc/hadoop-2.6.0/logs/hadoop-linuxidc-journalnode-linuxidc118.linuxidc.out
[linuxidc@linuxidc118 hadoop-2.6.0]$ jps
11447 JournalNode
11485 Jps

 2. 格式化namenode时报错:(最后查出来是没有关防火墙。。。免密码登陆不代表不用关防火墙)

15/08/20 02:12:45 INFO ipc.Client: Retrying connect to server: linuxidc119/192.168.75.119:8485. Already tried 8 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
15/08/20 02:12:46 INFO ipc.Client: Retrying connect to server: linuxidc118/192.168.75.118:8485. Already tried 8 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
15/08/20 02:12:46 INFO ipc.Client: Retrying connect to server: linuxidc120/192.168.75.120:8485. Already tried 9 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
15/08/20 02:12:46 INFO ipc.Client: Retrying connect to server: linuxidc119/192.168.75.119:8485. Already tried 9 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
15/08/20 02:12:46 WARN namenode.NameNode: Encountered exception during format: 
org.apache.hadoop.hdfs.qjournal.client.QuorumException: Unable to check if JNs are ready for formatting. 2 exceptions thrown:
192.168.75.120:8485: No Route to Host from  43.49.49.59.broad.ty.sx.dynamic.163data.com.cn/59.49.49.43 to linuxidc120:8485 failed on socket timeout exception: java.net.NoRouteToHostException: No route to host; For more details see:  /> 192.168.75.119:8485: No Route to Host from  43.49.49.59.broad.ty.sx.dynamic.163data.com.cn/59.49.49.43 to linuxidc119:8485 failed on socket timeout exception: java.net.NoRouteToHostException: No route to host; For more details see:  />     at org.apache.hadoop.hdfs.qjournal.client.QuorumException.create(QuorumException.java:81)
    at org.apache.hadoop.hdfs.qjournal.client.QuorumCall.rethrowException(QuorumCall.java:223)
    at org.apache.hadoop.hdfs.qjournal.client.QuorumJournalManager.hasSomeData(QuorumJournalManager.java:232)
    at org.apache.hadoop.hdfs.server.common.Storage.confirmFormat(Storage.java:884)
    at org.apache.hadoop.hdfs.server.namenode.FSImage.confirmFormat(FSImage.java:171)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:937)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1379)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1504)
15/08/20 02:12:47 INFO ipc.Client: Retrying connect to server: linuxidc118/192.168.75.118:8485. Already tried 9 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=10, sleepTime=1000 MILLISECONDS)
15/08/20 02:12:47 FATAL namenode.NameNode: Failed to start namenode.
org.apache.hadoop.hdfs.qjournal.client.QuorumException: Unable to check if JNs are ready for formatting. 2 exceptions thrown:
192.168.75.120:8485: No Route to Host from  43.49.49.59.broad.ty.sx.dynamic.163data.com.cn/59.49.49.43 to linuxidc120:8485 failed on socket timeout exception: java.net.NoRouteToHostException: No route to host; For more details see:  /> 192.168.75.119:8485: No Route to Host from  43.49.49.59.broad.ty.sx.dynamic.163data.com.cn/59.49.49.43 to linuxidc119:8485 failed on socket timeout exception: java.net.NoRouteToHostException: No route to host; For more details see:  />     at org.apache.hadoop.hdfs.qjournal.client.QuorumException.create(QuorumException.java:81)
    at org.apache.hadoop.hdfs.qjournal.client.QuorumCall.rethrowException(QuorumCall.java:223)
    at org.apache.hadoop.hdfs.qjournal.client.QuorumJournalManager.hasSomeData(QuorumJournalManager.java:232)
    at org.apache.hadoop.hdfs.server.common.Storage.confirmFormat(Storage.java:884)
    at org.apache.hadoop.hdfs.server.namenode.FSImage.confirmFormat(FSImage.java:171)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:937)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1379)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1504)
15/08/20 02:12:47 INFO util.ExitUtil: Exiting with status 1
15/08/20 02:12:47 INFO namenode.NameNode: SHUTDOWN_MSG: 
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at 43.49.49.59.broad.ty.sx.dynamic.163data.com.cn/59.49.49.43

 格式化成功!

[linuxidc@linuxidc117 hadoop-2.6.0]$ bin/hdfs namenode -format -clusterId hadoop-cluster

15/08/20 02:22:05 INFO namenode.FSNamesystem: Append Enabled: true
15/08/20 02:22:06 INFO util.GSet: Computing capacity for map INodeMap
15/08/20 02:22:06 INFO util.GSet: VM type      = 64-bit
15/08/20 02:22:06 INFO util.GSet: 1.0% max memory 889 MB = 8.9 MB
15/08/20 02:22:06 INFO util.GSet: capacity      = 2^20 = 1048576 entries
15/08/20 02:22:06 INFO namenode.NameNode: Caching file names occuring more than 10 times
15/08/20 02:22:06 INFO util.GSet: Computing capacity for map cachedBlocks
15/08/20 02:22:06 INFO util.GSet: VM type      = 64-bit
15/08/20 02:22:06 INFO util.GSet: 0.25% max memory 889 MB = 2.2 MB
15/08/20 02:22:06 INFO util.GSet: capacity      = 2^18 = 262144 entries
15/08/20 02:22:06 INFO namenode.FSNamesystem: dfs.namenode.safemode.threshold-pct = 0.9990000128746033
15/08/20 02:22:06 INFO namenode.FSNamesystem: dfs.namenode.safemode.min.datanodes = 0
15/08/20 02:22:06 INFO namenode.FSNamesystem: dfs.namenode.safemode.extension    = 30000
15/08/20 02:22:06 INFO namenode.FSNamesystem: Retry cache on namenode is enabled
15/08/20 02:22:06 INFO namenode.FSNamesystem: Retry cache will use 0.03 of total heap and retry cache entry expiry time is 600000 millis
15/08/20 02:22:06 INFO util.GSet: Computing capacity for map NameNodeRetryCache
15/08/20 02:22:06 INFO util.GSet: VM type      = 64-bit
15/08/20 02:22:06 INFO util.GSet: 0.029999999329447746% max memory 889 MB = 273.1 KB
15/08/20 02:22:06 INFO util.GSet: capacity      = 2^15 = 32768 entries
15/08/20 02:22:06 INFO namenode.NNConf: ACLs enabled? false
15/08/20 02:22:06 INFO namenode.NNConf: XAttrs enabled? true
15/08/20 02:22:06 INFO namenode.NNConf: Maximum size of an xattr: 16384
15/08/20 02:22:08 INFO namenode.FSImage: Allocated new BlockPoolId: BP-971817124-192.168.75.117-1440062528650
15/08/20 02:22:08 INFO common.Storage: Storage directory /home/linuxidc/hadoop/hdfs/name has been successfully formatted.
15/08/20 02:22:10 INFO namenode.NNStorageRetentionManager: Going to retain 1 images with txid >= 0
15/08/20 02:22:10 INFO util.ExitUtil: Exiting with status 0
15/08/20 02:22:10 INFO namenode.NameNode: SHUTDOWN_MSG: 
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at linuxidc117/192.168.75.117
************************************************************/

 3.开启namenode:

[linuxidc@linuxidc117 hadoop-2.6.0]$ sbin/hadoop-daemon.sh start namenode
starting namenode, logging to /home/linuxidc/hadoop-2.6.0/logs/hadoop-linuxidc-namenode-linuxidc117.out
[linuxidc@linuxidc117 hadoop-2.6.0]$ jps
18550 NameNode
18604 Jps

4.格式化standby namenode

[linuxidc@linuxidc119 hadoop-2.6.0]$ bin/hdfs namenode -bootstrapStandby
15/08/20 02:36:26 INFO namenode.NameNode: STARTUP_MSG: 
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG:  host = linuxidc119/192.168.75.119
STARTUP_MSG:  args = [-bootstrapStandby]
STARTUP_MSG:  version = 2.6.0
..... 
.....
STARTUP_MSG:  build = -r e3496499ecb8d220fba99dc5ed4c99c8f9e33bb1; compiled by 'jenkins' on 2014-11-13T21:10Z
STARTUP_MSG:  java = 1.8.0_51
************************************************************/
15/08/20 02:36:26 INFO namenode.NameNode: registered UNIX signal handlers for [TERM, HUP, INT]
15/08/20 02:36:26 INFO namenode.NameNode: createNameNode [-bootstrapStandby]
=====================================================
About to bootstrap Standby ID nn2 from:
          Nameservice ID: hadoop-cluster1
        Other Namenode ID: nn1
  Other NN's HTTP address: />   Other NN's IPC  address: linuxidc117/192.168.75.117:8020
            Namespace ID: 1244139539
            Block pool ID: BP-971817124-192.168.75.117-1440062528650
              Cluster ID: hadoop-cluster
          Layout version: -60
=====================================================
15/08/20 02:36:28 INFO common.Storage: Storage directory /home/linuxidc/hadoop/hdfs/name has been successfully formatted.
15/08/20 02:36:29 INFO namenode.TransferFsImage: Opening connection to http://linuxidc117:50070/imagetransfer?getimage=1&txid=0&storageInfo=-60:1244139539:0:hadoop-cluster
15/08/20 02:36:30 INFO namenode.TransferFsImage: Image Transfer timeout configured to 60000 milliseconds
15/08/20 02:36:30 INFO namenode.TransferFsImage: Transfer took 0.01s at 0.00 KB/s
15/08/20 02:36:30 INFO namenode.TransferFsImage: Downloaded file fsimage.ckpt_0000000000000000000 size 352 bytes.
15/08/20 02:36:30 INFO util.ExitUtil: Exiting with status 0
15/08/20 02:36:30 INFO namenode.NameNode: SHUTDOWN_MSG: 
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at linuxidc119/192.168.75.119
************************************************************/

5.开启standby namenode

[linuxidc@linuxidc119 hadoop-2.6.0]$ sbin/hadoop-daemon.sh start namenode
starting namenode, logging to /home/linuxidc/hadoop-2.6.0/logs/hadoop-linuxidc-namenode-linuxidc119.out
[linuxidc@linuxidc119 hadoop-2.6.0]$ jps
14401 JournalNode
15407 NameNode
15455 Jps

在web上 打开以后二个显示都是standy状态:

使用这个命令将nn1切换为active状态:

bin/hdfs haadmin -ns hadoop-cluster1 -transitionToActive nn1

另外两个一样的道理:

开启所有的datanode,这里是在只有配置好ssh免密码登录的情况下才能使用。可以参考:

[linuxidc@linuxidc117 hadoop-2.6.0]$ sbin/hadoop-daemons.sh start datanode

 开了仨,就是之前预设好的192.168.1.118,192.168.1.119和192.168.1.120

启动yarn

[linuxidc@linuxidc117 hadoop-2.6.0]$ sbin/start-yarn.sh

starting yarn daemons
starting resourcemanager, logging to /home/linuxidc/hadoop-2.6.0/logs/yarn-linuxidc-resourcemanager-linuxidc117.out
linuxidc118: nodemanager running as process 14812. Stop it first.
linuxidc120: nodemanager running as process 14025. Stop it first.
linuxidc119: nodemanager running as process 17590. Stop it first.
[linuxidc@linuxidc117 hadoop-2.6.0]$ jps
NameNode
Jps
ResourceManager

也是可以看到有三个datanode

最后总结一下吧...... 自学大数据的话,有一个简单的部署就足够了,能够让你写好的程序放入hdfs中跑就可以了,这样的集群应该是在最后,或者需要的时候再去详细的做研究,抓紧进入之后的阶段吧~~

Hadoop如何修改HDFS文件存储块大小  

将本地文件拷到HDFS中 

从HDFS下载文件到本地 

将本地文件上传至HDFS 

HDFS基本文件常用命令 

Hadoop中HDFS和MapReduce节点基本简介 

《Hadoop实战》中文版+英文文字版+源码【PDF】 

Hadoop: The Definitive Guide【PDF版】 

本文永久更新链接地址

阅读(1027) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~