我已经和Titan图形服务器玩了一段时间了.我的感觉是,尽管有大量文档,但缺乏从头开始入门教程.
我的最终目标是让一个巨人在cassandra上运行并使用StartTheShift/thunderdome进行查询.
我见过几种启动泰坦的方法:
从这个链接,我能够通过以下步骤运行titan服务器:
titan-all-0.3.0/libs到rexster-server-2.3.0/ext/titan编辑rexster-server-2.3.0/rexster.xml和添加(在a之间):
<graph>
<graph-name>geograph</graph-name>
<graph-type>com.thinkaurelius.titan.tinkerpop.rexster.TitanGraphConfiguration</graph-type>
<graph-read-only>false</graph-read-only>
<graph-location>/Users/vallette/projects/DATA/gdb</graph-location>
<properties>
<storage.backend>local</storage.backend>
<storage.directory>/Users/vallette/projects/DATA/gdb</storage.directory>
<buffer-size>100</buffer-size>
</properties>
<extensions>
<allows>
<allow>tp:gremlin</allow>
</allows>
</extensions>
</graph>
Run Code Online (Sandbox Code Playgroud)对于berkeleydb或:
<graph>
<graph-name>geograph</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>cassandra</storage.backend>
<storage.hostname>77.77.77.77</storage.hostname>
</properties>
<extensions>
<allows>
<allow>tp:gremlin</allow>
</allows>
</extensions>
</graph>
Run Code Online (Sandbox Code Playgroud)
对于cassandra db.
./bin/rexster.sh -s -c rexster.xmlbin/rexster-console.shg = rexster.getGraph("geograph")这种方法的问题是你通过rexster而不是gremlin连接,所以你没有自动完成.优点是您可以命名您的数据库(此处为地理位置).
./bin/titan.sh config/titan-server-rexster.xml config/titan-server-cassandra.properties创建一个名为cassandra.localwith …
在今天可以使用图形数据库解决的Web环境中,可以遇到的问题是什么?图形数据库是否适用于经典应用程序,即可以用作关系数据库的替代品吗?所以实际上这是两个问题.
我试图建立一个完全基本的Titan Rexster Cassandra实例,但我似乎无法打破代码.我现在已经尝试了很多东西来使它工作,但我似乎无法让它工作.无论我读了多少,我都无法正确设置它.
我想要的是一个以嵌入模式运行的Titan-rexster-cassandra实例,其中包含一些索引,包括弹性搜索.在我阅读完所有内容之后,似乎这是我在下载titan-server-0.4.0并运行bin/titan.sh start命令时应该得到的.这也启动了服务器.但是:当我尝试为此添加索引时,没有任何反应.当我尝试在RexPro上填充它时,没有添加任何内容.
当我重新启动服务器时,我的图表消失了.当我去的时候,它不再出现在Rexster图表列表中http://localhost:8182/graphs.因此看起来我的数据不会持续存在,或者至少在rexster中消失.
我觉得我已经尝试了一切来实现这个目的:
.properties包含搜索索引,如下所示:storrage.index.search.backend=elasticsearch....properties(所有的)使用的文件cassandra,embeddedcassandra并cassandrathrift为storage.backendtitan.sh文件,看看实际发生了什么,然后转到这些指示的配置文件,并看看那里发生了什么,我已经尝试了很多东西,如上所述.我已经在这一周内挣扎了一个多星期,可能是两个甚至更多,我开始失去信心.我正在考虑回到neo4j,但不幸的是我真的需要Titan的可扩展性.但是,如果我不能让它工作,那就没用了.我觉得可能有一些微不足道但却必不可少的事情,我没想到或忘记了.
有没有人知道那里的指南带你从绝对的划痕(例如,启动一个新的VM或其他东西),或接近它,到一个运行弹性搜索索引的titan-rexster-cassandra实例?或许,如果你很棒,提供这样的指南?我感到失落 :(
关键点:
Ubuntu 12.04(也试过13.10.同样的问题)
泰坦0.4.0
目标:要获得持久性,请使用弹性搜索索引顶点名称属性,并获得具有权重的边.
像这样连接ruby rexpro:
require "rexpro" #the "rexpro" gem
rexpro_client = Rexpro::Client.new(host: 'the.ip.of.my.machine.running.rexster', port: 8184)
results = rexpro_client.execute("g.getClass()", graph_name: "graph").results
#=> returns the following: class com.thinkaurelius.titan.graphdb.database.StandardTitanGraph
Run Code Online (Sandbox Code Playgroud)
我遵循以下步骤来创建数据库不存在的问题:
Ubuntu 12.04 LTS使用名称vmname(或其他)创建一个新的小型(1核,1.75GB ram)VM .ssh azureuser@vmname.cloudhost.net -p 22 …我使用Titan 0.4.0 All,在Ubuntu 12.04上以共享VM模式运行Rexster.
我怎样才能正确删除使用Cassandra存储后端的Titan中的图形?
我试过了TitanCleanup.clear(graph),但它并没有删除所有内容.指数仍在那里.我真正的问题是我有一个我不想要的索引(它会崩溃每个查询),但是我了解Titan的文档,一旦创建了索引就不可能删除它.
我坚持使用我的TitanDB,Django1.8和Mogwai0.7.7软件包.我在localhost dev机器上有Graph数据库titan/cassandra,在rexster gremlin web界面中创建错误查询后,我的Django Object Graph Mapper mogwai停止工作.Titan仍在工作,数据存在,但Django停止使用它.
文件"/Users/x/envs/graph/lib/python2.7/site-packages/rexpro/connectors/base.py",第281行,在close_transaction中引发exceptions.RexProScriptException("事务未打开")RexProScriptException:transaction不开放.
谷歌搜索后我发现这个bitbucked修复 但我不知道如何应用它.也许lib更新与pip ....请帮助.
我是新手,我正试图让Titan使用Python.我已经在这一天打了一个半天,无法到达任何地方.我尝试过灯泡和rexpro-python,但似乎没什么用.
在rexpro-python中有以下代码:
from rexpro import RexProConnection
conn = RexProConnection('localhost', 8184, 'graph')
Run Code Online (Sandbox Code Playgroud)
将挂起并且服务器产生以下消息(对于titan版本0.3.2,0.3.1和0.2.1)
13/09/18 16:59:27 WARN filter.RexProMessageFilter: unsupported rexpro version: 1
Run Code Online (Sandbox Code Playgroud)
在灯泡:
from bulbs.config import Config, DEBUG
from bulbs.rexster import Graph
config = Config('http://localhost:8182/graphs/graph')
g = Graph(config)
Run Code Online (Sandbox Code Playgroud)
产生以下错误:
SystemError: ({'status': '500', 'transfer-encoding': 'chunked', 'server': 'grizzly/2.2.16', 'connection': 'close', 'date': 'Wed, 18 Sep 2013 21:06:27 GMT', 'access-control-allow-origin': '*', 'content-type': 'application/json'}, '{"message":"","error":"javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: groovy.lang.MissingMethodException.idx() is applicable for argument types: () values: []\\nPossible solutions: is(java.lang.Object), any(), find(), …Run Code Online (Sandbox Code Playgroud) 所以,我在mac-osx上使用python3.2和灯泡,使用rexster和orientdb.细节:
orientdb - 从他们的页面下载标准
〜/工作区/ orientdb社区-1.7-RC1
运行服务器, ./bin/server.sh
database - orientdb database~/databases/orientdb/dev-db-01
rexster - 来自github git clone的标准结账git://github.com/tinkerpop/rexster.wiki.git~/ workspace /
配置/ rexster.xml:
...
<graph>
<graph-enabled>true</graph-enabled>
<graph-name>dev-db-01</graph-name>
<graph-type>orientgraph</graph-type>
<graph-location>local:*<path to...>*/databases/orientdb/dev-db-01</graph-location>
<properties>
<username>admin</username>
<password>admin</password>
</properties>
<extensions>
<allows>
<allow>tp:gremlin</allow>
</allows>
</extensions>
</graph>
...
Run Code Online (Sandbox Code Playgroud)
Python代码:
from bulbs.rexster import Graph
from bulbs.config import Config
config = Config("http://localhost:8182/dev-db-01/", username="admin", password="admin")
g = Graph(config)
Run Code Online (Sandbox Code Playgroud)
问题:
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/opt/local/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/bulbs/rexster/graph.py", li ne 56, in __init__
super(Graph, self).__init__(config) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/bulbs/base/graph.py", line …Run Code Online (Sandbox Code Playgroud) 我正在使用Titan Rexster(titan-server-0.4.4.zip)和Elasticsearch后端在Ubuntu 12.4服务器上运行推荐系统.为了连接到Rexster Server,我使用Bulbflow库进行python.
Beta似乎运行良好3周,但随着负载"增加"(只有几个用户~10),Rexster服务器停止响应.我不知道我的rexster配置是错误的还是我没有正确使用Bulbflow库.
这是我的rexster-cassandra-es.xml:
<?xml version="1.0" encoding="UTF-8"?>
<rexster>
<http>
<server-port>8182</server-port>
<server-host>0.0.0.0</server-host>
<base-uri>http://MY_IP</base-uri>
<web-root>public</web-root>
<character-set>UTF-8</character-set>
<enable-jmx>false</enable-jmx>
<enable-doghouse>true</enable-doghouse>
<max-post-size>2097152</max-post-size>
<max-header-size>8192</max-header-size>
<upload-timeout-millis>30000</upload-timeout-millis>
<thread-pool>
<worker>
<core-size>20</core-size>
<max-size>40</max-size>
</worker>
<kernal>
<core-size>10</core-size>
<max-size>20</max-size>
</kernal>
</thread-pool>
<io-strategy>leader-follower</io-strategy>
</http>
<rexpro>
<server-port>8184</server-port>
<server-host>0.0.0.0</server-host>
<session-max-idle>1790000</session-max-idle>
<session-check-interval>3000000</session-check-interval>
<connection-max-idle>180000</connection-max-idle>
<connection-check-interval>3000000</connection-check-interval>
<enable-jmx>false</enable-jmx>
<thread-pool>
<worker>
<core-size>8</core-size>
<max-size>8</max-size>
</worker>
<kernal>
<core-size>4</core-size>
<max-size>4</max-size>
</kernal>
</thread-pool>
<io-strategy>leader-follower</io-strategy>
</rexpro>
<shutdown-port>8183</shutdown-port>
<shutdown-host>127.0.0.1</shutdown-host>
<script-engines>
<script-engine>
<name>gremlin-groovy</name>
<reset-threshold>-1</reset-threshold>
<imports>com.tinkerpop.gremlin.*,com.tinkerpop.gremlin.java.*,com.tinkerpop.gremlin.pipes.filter.*,com.tinkerpop.gremlin.pipes.sideeffect.*,com.tinkerpop.gremlin.pipes.transform.*,com.tinkerpop.blueprints.*,com.tinkerpop.blueprints.impls.*,com.tinkerpop.blueprints.impls.tg.*,com.tinkerpop.blueprints.impls.neo4j.*,com.tinkerpop.blueprints.impls.neo4j.batch.*,com.tinkerpop.blueprints.impls.orient.*,com.tinkerpop.blueprints.impls.orient.batch.*,com.tinkerpop.blueprints.impls.dex.*,com.tinkerpop.blueprints.impls.rexster.*,com.tinkerpop.blueprints.impls.sail.*,com.tinkerpop.blueprints.impls.sail.impls.*,com.tinkerpop.blueprints.util.*,com.tinkerpop.blueprints.util.io.*,com.tinkerpop.blueprints.util.io.gml.*,com.tinkerpop.blueprints.util.io.graphml.*,com.tinkerpop.blueprints.util.io.graphson.*,com.tinkerpop.blueprints.util.wrappers.*,com.tinkerpop.blueprints.util.wrappers.batch.*,com.tinkerpop.blueprints.util.wrappers.batch.cache.*,com.tinkerpop.blueprints.util.wrappers.event.*,com.tinkerpop.blueprints.util.wrappers.event.listener.*,com.tinkerpop.blueprints.util.wrappers.id.*,com.tinkerpop.blueprints.util.wrappers.partition.*,com.tinkerpop.blueprints.util.wrappers.readonly.*,com.tinkerpop.blueprints.oupls.sail.*,com.tinkerpop.blueprints.oupls.sail.pg.*,com.tinkerpop.blueprints.oupls.jung.*,com.tinkerpop.pipes.*,com.tinkerpop.pipes.branch.*,com.tinkerpop.pipes.filter.*,com.tinkerpop.pipes.sideeffect.*,com.tinkerpop.pipes.transform.*,com.tinkerpop.pipes.util.*,com.tinkerpop.pipes.util.iterators.*,com.tinkerpop.pipes.util.structures.*,org.apache.commons.configuration.*,com.thinkaurelius.titan.core.*,com.thinkaurelius.titan.core.attribute.*,com.thinkaurelius.titan.core.util.*,com.thinkaurelius.titan.example.*,org.apache.commons.configuration.*,com.tinkerpop.gremlin.Tokens.T,com.tinkerpop.gremlin.groovy.*</imports>
<static-imports>com.tinkerpop.blueprints.Direction.*,com.tinkerpop.blueprints.TransactionalGraph$Conclusion.*,com.tinkerpop.blueprints.Compare.*,com.thinkaurelius.titan.core.attribute.Geo.*,com.thinkaurelius.titan.core.attribute.Text.*,com.thinkaurelius.titan.core.TypeMaker$UniquenessConsistency.*,com.tinkerpop.blueprints.Query$Compare.*</static-imports>
</script-engine>
</script-engines>
<security>
<authentication>
<type>none</type>
<configuration>
<users>
<user>
<username>rexster</username>
<password>rexster</password>
</user>
</users>
</configuration>
</authentication>
</security>
<metrics>
<reporter> …Run Code Online (Sandbox Code Playgroud) 我从网址上下载了EC2服务器上的Titan Version 1.0
然后我用以下命令解压缩并运行titan服务器:
bin/titan.sh启动
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.
Run Code Online (Sandbox Code Playgroud)
然后我尝试从Titan 1.0版本的HTTP请求(在titan 0.4版本Rexster工作正常)但我得到以下错误
使用以下命令使用索引以获得更好的性能来查询titan db中的节点.
TitanManagement mgmt = graph.openManagement();
PropertyKey buyer = mgmt.makePropertyKey("buyer").dataType(String.class).cardinality(Cardinality.SINGLE).make();
TitanGraphIndex buyeri = mgmt.buildIndex("buyer", Vertex.class).addKey(buyer).buildCompositeIndex();
mgmt.setConsistency(buyeri, ConsistencyModifier.LOCK);
g.V().has("buyer","buyer", "buyer10").out("order_is").values("order").fill(list);
Run Code Online (Sandbox Code Playgroud)
使用titan 1.0.0,gremlin查询语言,在运行此查询时会抛出错误:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
at java.lang.Thread.run(Thread.java:745)Caused by: com.thinkaurelius.titan.core.SchemaViolationException: Adding this property for key [~T$SchemaName] and value [rtbuyer] violates a uniqueness constraint [SystemIndex#~T$SchemaName]
at com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx.addProperty(StandardTitanTx.java:780)
at com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx.addProperty(StandardTitanTx.java:706)
at com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx.makeSchemaVertex(StandardTitanTx.java:836)
at com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx.makePropertyKey(StandardTitanTx.java:856)
at com.thinkaurelius.titan.graphdb.types.StandardPropertyKeyMaker.make(StandardPropertyKeyMaker.java:86)
at pluradj.titan.tinkerpop3.example.JavaExample2.main(JavaExample2.java:56)
Run Code Online (Sandbox Code Playgroud)
更新如下所述@jason Plurad回答
我用过
PropertyKey buyer = (!mgmt.containsPropertyKey("buyer")) ?
mgmt.makePropertyKey("buyer").dataType(String.class).cardinality(Cardinality.SINGLE).make() :
mgmt.getPropertyKey("buyer");
TitanGraphIndex buyeri = mgmt.getGraphIndex("buyeri");
if (buyeri …Run Code Online (Sandbox Code Playgroud)