JanusGraph Server的配置和使用

        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,本例中是单机环境,所以设置为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上创建表和索引。

[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. 完成收工

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

锁柱子

想白嫖?(笑)嫖就嫖吧(哈哈)

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值