Titan数据库简介
Titan 是一个可扩展的图形数据库,结合HBase、Cassandra、BerkeleyDB提供存储功能,ES、Lucene、Solar提供索引功能,可利用Hadoop计算框架对图数据进行分析、统计。经过优化,可用于存储和索引分布于多节点集群的百亿级顶点和边的图,同时,Titan又是一个事务数据库,可以支持数千个并发用户实时执行复杂图形遍历。
- 框架
Titan是一个图形数据库引擎,其本身专注于紧凑图表序列化,丰富的图形数据库建模和高效的查询执行。其框架主要如下:
- Titan与底层磁盘之间有多个存储和索引适配器:
- 存储:
- Cassandra
- HBase
- BerkeleyDB
- 索引:
- Elasticsearch
- Solr
- Lucene
- 存储:
- Titan提供了三种交互式接口:
- TitanGraph API
- TinkPop API
- Management API
- Titan与底层磁盘之间有多个存储和索引适配器:
Titan数据库环境配置
- 下载titan-1.0.0-hadoop2.zip解压。
配置文件
进入
conf/es
文件夹,配置elasticsearch.yml
,截取如下:1
2
3
4
5
6
7
8path.data: db/es/data
path.work: db/es/work
path.logs: log
path.plugins: bin/esplugins
network.host: 22.144.110.125
transport.tcp.port: 9300
http.port: 9200
discovery.zen.ping.unicast.hosts: ["hadoop1","hadoop2","hadoop3","hadoop4","hadoop5","hadoop6"]进入
conf
文件夹,配置titan-hbase-es.properties
,截取如下:1
2
3
4
5
6
7
8
9storage.backend=hbase
storage.hostname=hadoop1, hadoop2, hadoop3, hadoop4, hadoop5, hadoop6
cache.db-cache = true
cache.db-cache-clean-wait = 20
cache.db-cache-time = 180000
cache.db-cache-size = 0.5
index.search.backend=elasticsearch
index.search.hostname=hadoop5
index.search.elasticsearch.client-only=true
启动
- 进入
bin
目录,运行elasticsearch
:
- 重开终端,运行
gremlin.sh
:
输入以下脚本:
1
2
3graph = TitanFactory.open('../conf/titan-hbase-es.properties')
g = graph.traversal()
saturn = g.V().has('name', 'saturn').next()
- 进入