titan gremlin rest api配置方法

转载 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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值