簡體   English   中英

如何在Bulbs的Titan / Rexster中創建和開始使用圖形數據庫

[英]How to create and start working with a graph database in Titan/Rexster from Bulbs

我已經下載了titan-server-0.4.4.zip並解壓縮並運行:

$ bin/titan.sh start

這開始了CassandraTitan + Rexster 現在,我想為我的應用程序(例如'ggg')創建一個新圖,該圖是要在我的Python源代碼中從Bulbs創建的。 這是我在python2.7控制台中嘗試過的:

>>> from bulbs.titan import Graph, Config
>>> config = Config('/home/kevin/ggg') 
>>> g = Graph(config)     # Hoping that this will create all the graph related files

現在,我進入了rexster Web界面,我只能看到一個名為graph

{"version":"2.4.0","name":"Rexster: A Graph Server","graphs":["graph"],
"queryTime":0.567623,"upTime":"0[d]:05[h]:43[m]:05[s]"}

我做錯了什么嗎? 我嘗試查看文檔,但找不到任何可以幫助我的東西。

謝謝你的時間。

您需要編輯rexster的配置文件以將新圖形告知它。 這是我的config / rexster.xml條目

<graph-name>productionDB</graph-name>
  <graphtype>com.thinkaurelius.titan.tinkerpop.rexster.TitanGraphConfiguration</graphtype>
  <graph-location>/db/titan/main</graph-location>
  <graph-read-only>false</graph-read-only>
  <properties>
        <storage.backend>cassandra</storage.backend>
        <storage.hostname>127.0.0.1</storage.hostname>
        <storage.buffer-size>100</storage.buffer-size>
  </properties>
  <extensions>
    <allows>
      <allow>tp:gremlin</allow>
    </allows>
  </extensions>
</graph>

Rexster在一台服務器上支持多個圖形,而Titan Server僅支持一個圖形,默認情況下,其名稱為“ graph”:

bulbs.titan module已預先配置為使用graph作為名稱,以便保持簡單,不要在Titan配置中更改名稱,因此您可以使用默認的Bulbs配置而無需對其進行修改:

>>> from bulbs.titan import Graph
>>> g = Graph()   # using default config

參見https://github.com/espeed/bulbs/blob/master/bulbs/titan/client.py#L29

順便說一句:如果要使用其他圖形名稱,則需要提供其Titan服務器URI,而不是文件路徑。

換句話說,不要這樣做:

>>> config = Config('/home/kevin/ggg')

...做這個...

>>> config = Config('http://localhost:8182/graphs/ggg')

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM