您的位置:首页 > 其它

titan gremlin rest api配置方法

2016-10-29 15:12 302 查看
转载 https://groups.google.com/forum/#!msg/aureliusgraphs/v4UcYwE5UVU/samrajw6CgAJ

1. If you're starting from the
titan-1.0.0-hadoop1.zip, I'd suggest making a copy of conf/gremlin-server/gremlin-server.yaml into conf/rest-gremlin-server.yaml. Also, copy conf/titan-cassandra.properties to conf/gremlin-server/titan-cassandra-server.properties

cp conf/gremlin-server/gremlin-server.yaml conf/rest-gremlin-server.yaml

cp conf/titan-cassandra.properties conf/gremlin-server/titan-cassandra-server.properties


2. If you're planning to connect to Gremlin Server from something other than localhost, you'll want to update the host with its IP address or 0.0.0.0 in rest-gremlin-server.yaml

host: 0.0.0.0


3. Configure the Gremlin Server for REST instead of WebSockets (refer to the Gremlin Server

documentation). In the rest-gremlin-server.yaml, update the channelizer

channelizer: org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer


4. Configure the Gremlin Server mapping with the Cassandra properties file with your graph configuration

graphs: {

  graph: conf/gremlin-server/titan-cassandra-server.properties}


5. Update the titan-cassandra-server.properties with your specific Cassandra properties. In particular, you'll want to update the keyspace name and possibly storage.hostname if Cassandra isn't running on localhost.

storage.hostname=127.0.0.1

storage.cassandra.keyspace=TITAN_DEMO


6. Sending Gremlin to the Gremlin Server configured for REST is the same, regardless of the actual Gremlin query. Do a HTTP POST of a JSON object with a pair { "gremlin": "g.V().count()" } to the Gremlin Server. Here's what it looks like with a curl:

curl -XPOST -Hcontent-type:application/json
-d '{"gremlin":"g.V().count()"}' http://localhost:8182


-- Jason
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: