??????? JanusGraph是一款圖數據庫,關于它的簡單安裝,大家可以看菌子的linux學習系列中的centos7下安裝janusGraph單機版。?
?????? JanusGraph Server有兩種連接方式,一種是socket,另一種是http。兩種方式的配置方式差別不大,也可以配置同時支持socket和http的模式。本文將直接配置同時支持socket和http的模式。
??????? 首先我們進入JanusGraph目錄的conf目錄中。我們需要的文件是janusgraph-hbase-es.properties和 gremlin-server/gremlin-server.yaml ,復制這兩個文件并重命名為http-janusgraph-hbase-es.properties, gremlin-server/http-gremlin-server.yaml

[root@localhost conf]# cp gremlin-server/gremlin-server.yaml gremlin-server/http-gremlin-server.yaml?
[root@localhost conf]# cp janusgraph-hbase-es.properties http-janusgraph-hbase-es.properties
1. 配置http-janusgraph-hbase-es.properties 文件
[root@localhost conf]# vi http-janusgraph-hbase-es.properties
??????? 首先確保storage.backend, storage.hostname and storage.hbase.table這些屬性是存在的。并且確保gremlin.graph=org.janusgraph.core.JanusGraphFactory這句話存在。沒有就加上。storage.backend指定存儲后端,在本例中是hbase。storage.hostname指定存儲端ip,本例中是單機環(huán)境,所以設置為localhost。storage.hbase.table設置在hbase中的存儲位置,在server啟動時,janusgraph會在hbase上自動建立該表,在本例中設置為test


2. 配置 gremlin-server/http-gremlin-server.yaml?文件,配置channelizer為org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer,則server會同時支持http和web socket。同時指定graph配置文件為剛才的http-janusgraph-hbase-es.properties文件路徑。
[root@localhost conf]# vi gremlin-server/http-gremlin-server.yaml

3. 配置結束,啟動gremlin server,運行gremlin-server.sh 并指定yaml配置文件為剛才配好的文件。janusgraph會自動在hbase和es上創(chuàng)建表和索引。
[root@localhost janusgraph]# ./bin/gremlin-server.sh conf/gremlin-server/http-gremlin-server.yaml

4. 驗證
[root@localhost ~]# curl -XPOST -Hcontent-type:application/json -d '{"gremlin":"g.V().count()"}' http://localhost:8182

5. 完成收工