janusgraph使用ConfiguredGraphFactory配置动态创建图

前言

如果之前是使用固定的一张或多张图,修改为使用动态创建不会影响之前的数据。

修改配置

编辑conf/germlin-server/gremlin-server/gremlin-server.yamll,添加graphManager 修改graphs的值.一般情况都是将Janusgraph作为服务端,应用作为客户端使用代码连接,所以需要修改channelizer并且需要修改ScriptFileGremlinPlugin,去掉里面的scripts/empty-sample.groovy脚本。

channelizer: org.janusgraph.channelizers.JanusGraphWebSocketChannelizer
graphManager: org.janusgraph.graphdb.management.JanusGraphManager
graphs: {
   
  ConfigurationManagementGraph: conf/JanusGraph-configurationmanagement.properties
}
scriptEngines: {
   
  gremlin-groovy: {
   
    plugins: {
   
               org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {
   files: []}}}}

ConfigurationManagementGraph的值参考之前的graphs值。JanusGraph-configurationmanagement.properties配置大致如下

gremlin.graph=org.janusgraph.core.ConfiguredGraphFactory
storage.backend=cql
graph.graphname=ConfigurationManagementGraph
storage.hostname=127.0.0.1
index.search.backend=elasticsearch
index.search.hostname=127.0.0.1

重启janusgraph

su janusgraph
bin/janusgraph.sh stop
bin/janusgraph.sh start

创建新图

使用带session方式连接服务端,conf/remote.yaml文件位置根据自己情况设置,这里使用默认值

:remote connect tinkerpop.server conf/remote.yaml
:remote console

设置后端存储和后端索引,graph.graphname是图的名称类似MySQL中的库名,这里的名称需要唯一且在后面的打开图时需要使用

map = 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值