图数据库Titan安装与部署

图数据库Titan-2安装与部署入门

概述

Titan有hadoop1与hadoop2两种release版本,由于生产环境的限制,我使用了hadoop2版本。在使用该版本时,对应的安装包会有一些问题,这个真的很坑的。

下载安装包

下载地址,选择下载Titan 1.0.0 with Hadoop 2

安装

* 在安装前需要确定,你运行titan的Java环境为1.8+ *
1) 将安装包拷贝到安装位置后解压缩:

unzip titan-1.0.0-hadoop2.zip

2) 删除并添加相关jar包
官方提供的hadoop2的安装包有一些问题,如果想要顺利的使用titan,必须删除相关的jar包,并添加一些缺失的jar包:
a. 删除异常jar包

hadoop-core-1.2.1.jar

b. 添加所需要的jar包,这些jar包可以通过maven进行下载

titan-hadoop-1.0.0.jar
titan-hadoop-core-1.0.0.jar

使用默认配置启动服务

titan安装后,使用默认配置启动titan服务。
默认情况下,titan会启动三个服务:

Cassandra 作为后端数据库存储图数据
Elasticsearch 作为索引,提高图的检索效率
Gremlin-Server 图数据库引擎,支持gremlin数据查询语法

启动Titan服务:

$ cd /path/to/titan-1.0.0-hadoop2
$ ./bin/titan.sh start
Forking Cassandra...
Running `nodetool statusthrift`.. OK (returned exit status 0 and printed string "running").
Forking Elasticsearch...
Connecting to Elasticsearch (127.0.0.1:9300)... OK (connected to 127.0.0.1:9300).
Forking Gremlin-Server...
Connecting to Gremlin-Server (127.0.0.1:8182).... OK (connected to 127.0.0.1:8182).
Run gremlin.sh to connect.

使用Gremlin客户端测试服务是否启动成功

titan安装包中已经带有gremlin-console,我么可以直接使用并测试:

cd /path/to/titan-1.0.0-hadoop2
$ ./bin/gremlin.sh

         \,,,/
         (o o)
-----oOOo-(3)-oOOo-----
plugin activated: aurelius.titan
plugin activated: tinkerpop.server
plugin activated: tinkerpop.utilities
plugin activated: tinkerpop.tinkergraph
gremlin> :remote connect tinkerpop.server conf/remote.yaml         #连接titan服务
==>Connected - localhost/127.0.0.1:8182
gremlin> :> graph.addVertex("name", "stephen")    #添加图节点
==>v[4192]
gremlin> :> g.V().values('name')    #查询节点
==>stephen

猜你喜欢

转载自www.linuxidc.com/Linux/2017-03/141406.htm