titan是图数据库, rexster是图显示服务
下载 titan 0.3.2
解压 titan-all-0.3.2.zip 到 /opt/hugedata/share/
解压后得到 /opt/hugedata/share/titan-all-0.3.2/
建立软连接
cd /opt/hugedata/share/
ln -s titan-all-0.3.2 titan
/etc/profile 增加
export TITAN_HOME=/opt/hugedata/share/titan
source /etc/profile
----------------------
测试titan, 生成graph
cd $TITAN_HOME
bin/gremlin.sh
gremlin> g = GraphOfTheGodsFactory.create('/tmp/titan')
==>titangraph[local:/tmp/titan]
gremlin> saturn = g.V('name','saturn').next()
==>v[4]
gremlin> saturn.map()
==>name=saturn
==>age=10000
==>type=titan
gremlin> saturn.in('father').in('father').name
==>hercules
chmod 777 /tmp/titan
更多资料请参照 https://github.com/thinkaurelius/titan/wiki
下载 rexster 2.3.0
解压 rexster-server-2.3.0.zip 到 /opt/hugedata/share/
解压后得到 /opt/hugedata/share/rexster-server-2.3.0/
建立软连接
cd /opt/hugedata/share/
ln -s rexster-server-2.3.0 rexster
cd /opt/hugedata/share/rexster
mkdir logs
chmod 777 logs
打开 bin/rexster-service.sh
修改变量 REXSTER_DIR="/opt/hugedata/share/rexster-server-2.3.0"
修改变量 REXSTER_LOG_DIR="/opt/hugedata/share/rexster-server-2.3.0/logs"
ln -s /opt/hugedata/share/rexster/bin/rexster-service.sh /etc/init.d/rexster
chkconfig --add rexster
cd /opt/hugedata/share/rexster
修改 rexster.xml
修改配置 <rexster>/<http>/<server-host> 到安装机器 <host ip>
修改配置 <rexster>/<http>/<base-uri> 到安装机器 http://<host ip>
/etc/profile 增加
export REXSTER_HOME=/opt/hugedata/share/rexster
source /etc/profile
cd /opt/hugedata/share/rexster
mkdir ext/titan
cp $TITAN_HOME/lib/* $REXSTER_HOME/ext/titan
bin/rexster-service.sh start
检查 logs/service.err, logs/service.log
rexster测试页面, 测试例子图是否能显示
http://<rexster 服务启动机器ip>:8182
cd /opt/hugedata/share/rexster
bin/rexster-service.sh stop
修改rexster.xml增加 <rexster>/<graphs>/<graph> 部分
<graph>
<graph-name>titanexample</graph-name>
<graph-type>com.thinkaurelius.titan.tinkerpop.rexster.TitanGraphConfiguration</graph-type>
<graph-location>/tmp/titan</graph-location>
<graph-read-only>false</graph-read-only>
<properties>
<storage.backend>local</storage.backend>
<storage.buffer-size>100</storage.buffer-size>
</properties>
<extensions>
<allows>
<allow>tp:gremlin</allow>
</allows>
</extensions>
</graph>
bin/rexster-service.sh start
rexster测试页面: http://<rexster host ip>:8182
cd /opt/hugedata/share/rexster
bin/rexster-service.sh stop
导入数据到 hbase
修改 rexster.xml, 增加一下
<graph>
<graph-enabled>true</graph-enabled>
<graph-name>ipgraph</graph-name>
<graph-type>com.thinkaurelius.titan.tinkerpop.rexster.TitanGraphConfiguration</graph-type>
<graph-location></graph-location>
<graph-read-only>false</graph-read-only>
<properties>
<storage.backend>hbase</storage.backend>
<storage.hostname>hbase zookeeper quorum ip, 逗号分隔</storage.hostname>
<storage.tablename>表名</storage.tablename>
</properties>
<extensions>
<allows>
<allow>tp:gremlin</allow>
</allows>
</extensions>
</graph>
bin/rexster-service.sh start
rexster测试页面: http://<rexster host ip>:8182
更多资料,参照 https://github.com/thinkaurelius/titan/wiki/Rexster-Graph-Server