http://blog.csdn.net/pipisorry/article/details/51350908
Requirements1. JDK 1.7.x + Hadoop 2.6.x
Installation reference for Hadoop [Hadoop:hadoop single-Machine pseudo-distributed installation and configuration]
2. Protocol Buffers
[Email protected]:/# apt-get Update
[Email protected]:/# sudo apt-get install Protobuf-c-compiler libprotobuf-c0 Libprotobuf-c0-dev
Download and install Graphlite
[Email protected]:/# apt-get install-y git #没有安装git的话要安装, LZ uses the environment configured in Docker, many do not
[Email protected]:/# cd/opt
[Email protected]:/opt# git clone https://github.com/schencoding/GraphLite.git
[Email protected]:/opt/graphlite/graphlite-0.20# vim bin/setenv
Export java_home=/opt/jdk1.8.0_91
Export hadoop_home=/usr/local/hadoop-2.6.4
Export graphlite_home=/opt/graphlite/graphlite-0.20
[Email protected]:/opt#. Bin/setenv
[Email protected]:/opt/graphlite/graphlite-0.20/# CD engine
[Email protected]:/opt/graphlite/graphlite-0.20/engine# apt-get install-y make #没有安装make的话要安装
[Email protected]:/opt/graphlite/graphlite-0.20/engine# make
[Email protected]:/opt/graphlite/graphlite-0.20/engine# CD.
Check if Bin/graphlite is successfully generated:
[Email protected]:/opt/graphlite/graphlite-0.20# ls bin/
Clean-output graphlite hash-partitioner.pl setenv start-graphlite start-worker
Compile and Run Vertex program1. Build Example
[Email protected]:/opt/graphlite/graphlite-0.20/# CD Example
[Email protected]:/opt/graphlite/graphlite-0.20/# apt-get install-y g++ #没有安装g + + to install
[Email protected]:/opt/graphlite/graphlite-0.20/example# make
g++-std=c++0x-g-o2-i/usr/local/hadoop-2.6.4/include-i/opt/graphlite/graphlite-0.20/include PageRankVertex.cc- Fpic-shared-o pagerankvertex.so
Check if example/pagerankvertex.so is successfully generated:
[Email protected]:/opt/graphlite/graphlite-0.20/example# ls
Makefile pagerankvertex.cc pagerankvertex.so
2. Run Example
[Email protected]:/opt/graphlite/graphlite-0.20/example# CD.
[Email protected]:/opt/graphlite/graphlite-0.20/#/etc/init.d/ssh start #没有开启ssh的要开启
[Email protected]:/opt/graphlite/graphlite-0.20# start-graphlite example/pagerankvertex.so Input/facebookcombined_ 4w Output/out
To view the results of the output:
[Email protected]:/opt/graphlite/graphlite-0.20# cat output/out_*
save Docker container as images
pika:~ $docker PS
pika:~ $docker Commit 2379 graphlite1
Of course, you can also test your own code and input files.
Write your own synchronization diagram calculation program and test the results of your code
#将自己写的代码KcoreVertex. cc and input file directories (code and input file download) mounted to the/MNT directory of Docker image
Note:KcoreVertex.cc content: Kcore: The Kcore of a graph G is a sub-graph of G, the degree >=K; input of each vertex of the sub-graph: An anisotropic graph (a pair of aligned edges); output: All vertices in the kcore sub-graph
pika:~ $docker run-v/media/pika/files/mine/c_workspace/bdms/bdms:/mnt-it graphlite1 Bash
[Email protected]:/opt/graphlite/graphlite-0.20/example# mv pagerankvertex.cc ori.cc #重命名之前的文件
[Email protected]:/opt/graphlite/graphlite-0.20/example# rm pagerankvertex.so #删除之前产生的中间文件
[Email protected]:/# cp/mnt/*.cc/opt/graphlite/graphlite-0.20/example
[Email protected]:/# cp/mnt/part2-input/*/opt/graphlite/graphlite-0.20/input
[Email protected]:/opt/graphlite/graphlite-0.20#. Bin/setenv
[Email protected]:/opt/graphlite/graphlite-0.20# cd example/
[Email protected]:/opt/graphlite/graphlite-0.20/example# make
[Email protected]:/opt/graphlite/graphlite-0.20/example# CD.
[Email protected]:/opt/graphlite/graphlite-0.20#/etc/init.d/ssh Start
[Email protected]:/opt/graphlite/graphlite-0.20# start-graphlite example/pagerankvertex.so Input/KCore-graph0_4w Output/out 6 #PageRankVertex实际已改成自己写的KcoreVertex, change the file name to modify the makefile file and make
[Email protected]:/opt/graphlite/graphlite-0.20# cat output/out_*
0
4
1
5
2
6
3
pika:~ $docker PS
pika:~ $docker commit <container id> graphlite
from:http://blog.csdn.net/pipisorry/article/details/51350908
Synchronization graph Calculation: Installation and use of Graphlite