一、简介:
hama是基于BSP(BulkSynchronous Parallel)计算技术的并行计算框架,用于大量的科学计算 。
二、Hama 的下载安装
1、下载网址:
http://archive.apache.org/dist/hama/
2、通过FlashFXP 文件传输助手连接虚拟机,将hama压缩文件上传到虚拟机的自定义目录下 (例如 我上传到home/hadoop/downloads/路径下)
3、在 自定义目录下进行解压
#:cd ~
#:cd /home/hadoop/downloads
`#:tar -zxvf 文件名
三、解压后修改名字及配置环境
一、修改解压后的文件名
mv 原文件名 hama
二、配置环境
1、修改hama-env.sh:
在Hama中进入conf文件夹,修改hama-env.sh文件,在其中加入Java的home 路径(jdk的路径)
vi hama-env.sh
export JAVA_HOME=/usr/lib/jvm/jdk
2、修改hama-site.xml,这是hama配置的核心文件
在Hama中进入conf文件夹,修改hama-site.xml文件
vi hama-site.xml
在中加入 以下代码,是本地就配置为local,即将value中的内容分别改为local,local,localhost
<configuration>
<property>
<name>bsp.master.address</name>
<value>local</value>
<description>The address of the bsp master server. Either the
literal string "local" or a host:port for distributed mode
</description>
</property>
<property>
<name>fs.default.name</name>
<value>local</value>
<description>
The name of the default file system. Either the literal string
"local" or a host:port for HDFS.
</description>
</property>
<property>
<name>hama.zookeeper.quorum</name>
<value>localhost</value>
<description>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.
</description>
</property>
</configuration>
四、Hama的一个使用案例
1、在hama路径下生成randomgraph
cd /home/hadoop/downloads/hama
2、在hama的bin/hama/下,进行jar jia 文件名,生成的文件位于hama 下的randomgraph。他表示100个节点,1000条边的数据存储在两个文件中
.bin/hama jar hama-exmaples-0.7.0.jar gen fastgen -v 100 -e 10 -o randomgrapg -t 2
3、执行pagerank,结果保存在pagerankresult文件中
./bin/hama/jar hama-xeamples-0.7.0.jarpagerank -i randomgraph -o pagerankresult -t 4