yp1234 发表于 2015-8-1 13:16:32

Apache Hama安装笔记

Hama介绍
  Apache Hama是一个纯BSP(Bulk Synchronous Parallel)计算框架,模仿了Google的Pregel。用来处理大规模的科学计算,特别是矩阵和图计算。
  BSP概念由Valiant(2010图灵奖获得者)在1990年提出,具体参看wikipedia。Google在2009年发表了论文,在分布式条件下实现了BSP模型。

Hama安装
  安装环境:
  OS: Ubuntu 12.04 64
  JAVA: jdk1.6.0_30
  Hadoop: hadoop-1.0.4
  安装Hama之前,应该首先确保系统中已经安装了hadoop,我这里选用的目前最新版本hadoop-1.0.4。
  第一步:下载并解压文件
  hama的下载地址:http://mirror.bit.edu.cn/apache/hama/0.6.0/ 我这里选用北京理工的apache镜像。
  解压文件到安装目录。我喜欢把hadoop和hama都安装在用户目录下,这样整个系统都比较干净。



tar -xvzf hama-0.6.0.tar.gz
  第二步:修改配置文件
  进入$HAMA_HOME/conf文件夹。
  修改hama-env.sh文件。加入JAVA_HOME变量。
  修改hama-site.xml文件。我的hama-site.xml配置文件如下:







bsp.master.address
LenovoE46a:40000
The address of the bsp master server. Either the
literal string "local" or a host:port for distributed mode



fs.default.name
LenovoE46a:9000/

The name of the default file system. Either the literal string
"local" or a host:port for HDFS.



hama.zookeeper.quorum
LenovoE46a
Comma separated list of servers in the ZooKeeper Quorum.
For example, "host1.mydomain.com,host2.mydomain.com,host3.mydomain.com".
By default this is set to localhost for local and pseudo-distributed modes
of operation. For a fully-distributed setup, this should be set to a full
list of ZooKeeper quorum servers. If HAMA_MANAGES_ZK is set in hama-env.sh
this is the list of servers which we will start/stop zookeeper on.



hama.zookeeper.property.clientPort
2181


  解释一下,bsp.master.address参数设置成bsp master地址。fs.default.name参数设置成hadoop里namenode的地址。hama.zookeeper.quorum和hama.zookeeper.property.clientPort两个参数和zookeeper有关,设置成为zookeeper的quorum server即可,单机伪分布式就是本机地址。
  第三步:运行Hama
  首先启动Hadoop,



% $HADOOP_HOME/bin/start-all.sh
  
  再启动Hama



% $HAMA_HOME/bin/start-bspd.sh
  查看所有的进程,检查是否启动成功。



jps
  
  第四步:运行例子程序
  这里我们选用Pagerank例子程序。
  首先上传数据到HDFS,数据的格式为:



Site1\tSite2\tSite3
Site2\tSite3
Site3
  执行Hama,其中/tmp/input/input.txt和/tmp/pagerank-output分别为输入文件和输出文件夹。



bin/hama jar ../hama-
0
.6.0-examples.jar pagerank /tmp/input/input.txt /tmp/pagerank-output

  成功!
页: [1]
查看完整版本: Apache Hama安装笔记