JanusGraph ConfiguredGraphFactory is not saving data created in Gremlin

  Kiến thức lập trình

I’ve been using Cassandra which I have working with JanusGraphFactory and now I’m trying to switch to use the Janus ConfiguredGraphFactory. Through Gremlin, I was able to add a configuration and then create a graph. The names can be recalled so it worked on some level. But I’m having trouble getting other features to work. When I create a new Vertex in a graph it appears to create it, but when I close and reopen Gremlin the graph is empty.

I’m also having trouble connecting from Java:

   Cluster cluster = Cluster.build("127.0.0.1").port(8182).create();
   cluster.connect();
   DriverRemoteConnection drc = DriverRemoteConnection.using(cluster, "graph1_traversal");
   GraphTraversalSource gts = traversal().withRemote(drc);
   System.out.println(gts.V().count().next());
   try {
       gts.close();
   } catch (Exception e) {
       System.out.println(e.getMessage());
   }

It appears to connect, print 0 similar to Gremlin but then hangs. In the past this happened because I forgot to close the connection or something. I’ve tried many permutations of options, but it just always hangs.

Here are the config files and some more details:

gremlin-cql-configuration.yaml

host: 0.0.0.0
port: 8182
evaluationTimeout: 30000
channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer
graphManager: org.janusgraph.graphdb.management.JanusGraphManager
graphs: {
  ConfigurationManagementGraph: conf/janusgraph-cql-configurationgraph.properties
}
scriptEngines: {
  gremlin-groovy: {
    plugins: { 
      org.janusgraph.graphdb.tinkerpop.plugin.JanusGraphGremlinPlugin: {},
      org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
      org.apache.tinkerpop.gremlin.tinkergraph.jsr223.TinkerGraphGremlinPlugin: {},
      org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {
          classImports: [java.lang.Math],
          methodImports: [java.lang.Math#*]},
          org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: []}}}}
processors:
  - { className: org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor, config: { sessionTimeout: 28800000 }}
  - { className: org.apache.tinkerpop.gremlin.server.op.traversal.TraversalOpProcessor, config: { cacheExpirationTime: 600000, cacheMaxSize: 1000 }}
metrics: {
  consoleReporter: {enabled: true, interval: 180000},
  csvReporter: {enabled: true, interval: 180000, fileName: /tmp/gremlin-server-metrics.csv},
  jmxReporter: {enabled: true},
  slf4jReporter: {enabled: true, interval: 180000},
  graphiteReporter: {enabled: false, interval: 180000}}
maxInitialLineLength: 4096
maxHeaderSize: 8192
maxChunkSize: 8192
maxContentLength: 65536
maxAccumulationBufferComponents: 1024
resultIterationBatchSize: 64
writeBufferLowWaterMark: 32768
writeBufferHighWaterMark: 65536

conf/janusgraph-cql-configurationgraph.properties

cache.db-cache = true
cache.db-cache-clean-wait = 20
cache.db-cache-size = 0.5
cache.db-cache-time = 180000
graph.graphname=ConfigurationManagementGraph
gremlin.graph=org.janusgraph.core.ConfiguredGraphFactory
storage.backend=cql
storage.hostname=127.0.0.1

remote-graph.properties

gremlin.remote.remoteConnectionClass=org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteConnection
gremlin.remote.driver.clusterFile=src/main/resources/conf/remote-objects.yaml
gremlin.remote.driver.sourceName=graph1_traversal
gremlin.graph=org.janusgraph.core.ConfiguredGraphFactory
storage.backend=cql

remote-objects.yaml

hosts: [127.0.0.1]
port: 8182
serializer: {
  className: org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV1,
  config: {
    ioRegistries: [
      org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry
    ]}
}

I can access the graphs through the Gremlin console via:

:remote connect tinkerpop.server conf/remote.yaml session
:remote console
ConfiguredGraphFactory.getGraphNames()
==>graph1
==>graph2

And when printed at the command line the graphs return:

graph1
==>standardjanusgraph[cql:[127.0.0.1]]

I create a vertex in graph1, graph1_traversal.addV("TEST"), close gremlin then reopen it and see:

graph1_traversal.V().count()
==>0

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT