ArangoDB-Community / arangodb-tinkerpop-provider

An implementation of the Tinkerpop OLTP Provider for ArangoDB
Apache License 2.0
83 stars 16 forks source link

Missing gremlin server configuration wiki #44

Closed fourier134949 closed 5 years ago

fourier134949 commented 5 years ago

Hi, I'm trying to set up arangodb provider on a gremlin server but I don't find any information on the wiki about the configuration that must be made in order to make the integration work. Would it be possible to add a gremlin server configuration section on the wiki?

Thanks in advance

arcanefoam commented 5 years ago

Hi, I haven't tried this scenario yet. Let me take a look at the gremlin docs and get back to you.

fdominik commented 5 years ago

Hi, I have my little local guide for me to help me when I need to get it running. This is what it contains:

in the gremlin-server-arangodb.yaml you can setup the configuration.

arcanefoam commented 5 years ago

Hi, The wiki has been updated with additional information about configuring the ArangoDB Tinkerpop Provider and how to use it with the server. Let me know if any additional information is required.

agentS commented 5 years ago

Hi,

Thank you so much for the wiki page. I followed it by downloading the extension, and creating a property file-based configuration for my graph. However, when starting the gremlin server, the exception which is shown below is thrown:

[WARN] DefaultGraphManager - Graph [modern] configured at [conf/arangodb-modern.properties] could not be instantiated and will not be available in Gremlin Server.  GraphFactory message: GraphFactory could not instantiate this Graph implementation [class com.arangodb.tinkerpop.gremlin.structure.ArangoDBGraph]
java.lang.RuntimeException: GraphFactory could not instantiate this Graph implementation [class com.arangodb.tinkerpop.gremlin.structure.ArangoDBGraph]
    at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:82)
    at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:70)
    at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:104)
    at org.apache.tinkerpop.gremlin.server.util.DefaultGraphManager.lambda$new$0(DefaultGraphManager.java:57)
    at java.util.LinkedHashMap$LinkedEntrySet.forEach(LinkedHashMap.java:671)
    at org.apache.tinkerpop.gremlin.server.util.DefaultGraphManager.<init>(DefaultGraphManager.java:55)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.apache.tinkerpop.gremlin.server.util.ServerGremlinExecutor.<init>(ServerGremlinExecutor.java:80)
    at org.apache.tinkerpop.gremlin.server.GremlinServer.<init>(GremlinServer.java:122)
    at org.apache.tinkerpop.gremlin.server.GremlinServer.<init>(GremlinServer.java:86)
    at org.apache.tinkerpop.gremlin.server.GremlinServer.main(GremlinServer.java:345)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:78)
    ... 13 more
Caused by: com.arangodb.tinkerpop.gremlin.client.ArangoDBGraphException: The provided argument can not be empty/null: null
    at com.arangodb.tinkerpop.gremlin.structure.ArangoDBGraph.checkValues(ArangoDBGraph.java:685)
    at com.arangodb.tinkerpop.gremlin.structure.ArangoDBGraph.<init>(ArangoDBGraph.java:566)
    at com.arangodb.tinkerpop.gremlin.structure.ArangoDBGraph.open(ArangoDBGraph.java:543)
    ... 18 more

I suspect that this exception is thrown, because the gremlin server somehow doesn't load the ArangoDB provider class. I included my configurations and would be most grateful if you could tell me which line I am missing.

My property file-based configuration for the graph is located in the file conf/arangodb-modern.properties and has the following content:

gremlin.graph = com.arangodb.tinkerpop.gremlin.structure.ArangoDBGraph
graph.db = GD_dev
graph.name = modern
arangodb.hosts = 127.0.0.1
arangodb.user = arangouser
arangodb.password = arangouser

The configuration file for the Gremlin server is shown below.

host: localhost
port: 8182
scriptEvaluationTimeout: 30000
channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer
graphs: {
  modern: conf/arangodb-modern.properties}
scriptEngines: {
  gremlin-groovy: {
    plugins: { org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
               org.apache.tinkerpop.gremlin.tinkergraph.jsr223.TinkerGraphGremlinPlugin: {},
               com.arangodb.tinkerpop.gremlin.jsr223.ArangoDBGremlinPlugin: {},
               org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {classImports: [java.lang.Math], methodImports: [java.lang.Math#*]},
               org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: [scripts/empty-sample.groovy]}}}}
serializers:
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV3d0] }}             # application/vnd.gremlin-v3.0+gryo
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { serializeResultToString: true }}                                                                       # application/vnd.gremlin-v3.0+gryo-stringd
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV3d0] }}         # application/json
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1 }                                                                                                            # application/vnd.graphbinary-v1.0
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}}
strictTransactionManagement: false
idleConnectionTimeout: 0
keepAliveInterval: 0
maxInitialLineLength: 4096
maxHeaderSize: 8192
maxChunkSize: 8192
maxContentLength: 65536
maxAccumulationBufferComponents: 1024
resultIterationBatchSize: 64
writeBufferLowWaterMark: 32768
writeBufferHighWaterMark: 65536
ssl: {
  enabled: false}
fdominik commented 5 years ago

Well mine looks a bit different, but I am not using the modern graph, but only the 'graph'. this is the different part in serializers:


 { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV3d0] }}         # application/json,application/vnd.gremlin-v3.0+json
 { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV2d0] }}         # application/vnd.gremlin-v2.0+json```
arcanefoam commented 5 years ago

Hi, The exception line indicates that the db name in the configuration was either missing or empty (I have fixed the useless exception message for next release). As far I can tell your configuration file does have the setting. So my only guess is that the wrong file is being loaded.

agentS commented 5 years ago

Thanks for your help, I'll look into this issue by the end of this week.

agentS commented 5 years ago

I tried following the suggestions of @fdominik; I changed the name of the graph from modern to graph and I added the serializer to my configuration. The updated configuration is shown below.


# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

host: localhost
port: 8182
scriptEvaluationTimeout: 30000
channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer
graphs: {
  graph: conf/arangodb-modern.properties}
scriptEngines: {
  gremlin-groovy: {
    plugins: { org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
               org.apache.tinkerpop.gremlin.tinkergraph.jsr223.TinkerGraphGremlinPlugin: {},
               com.arangodb.tinkerpop.gremlin.jsr223.ArangoDBGremlinPlugin: {},
               org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {classImports: [java.lang.Math], methodImports: [java.lang.Math#*]},
               org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: [scripts/empty-sample.groovy]}}}}
serializers:
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV3d0] }}             # application/vnd.gremlin-v3.0+gryo
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { serializeResultToString: true }}                                                                       # application/vnd.gremlin-v3.0+gryo-stringd
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV3d0] }}         # application/json
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV2d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV2d0] }}         # application/vnd.gremlin-v2.0+json
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1 }                                                                                                            # application/vnd.graphbinary-v1.0
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}}
strictTransactionManagement: false
idleConnectionTimeout: 0
keepAliveInterval: 0
maxInitialLineLength: 4096
maxHeaderSize: 8192
maxChunkSize: 8192
maxContentLength: 65536
maxAccumulationBufferComponents: 1024
resultIterationBatchSize: 64
writeBufferLowWaterMark: 32768
writeBufferHighWaterMark: 65536
ssl: {
  enabled: false}

@arcanefoam I think the properties file is loaded correctly, as it's the only file containing the name of the TinkerPop provider.

Anyway, thank you so much for your efforts!

agentS commented 5 years ago

I was able to solve the issue. I was missing the prefix for ArangoDB-specific options in the properties file. By adding the prefix gremlin.arangodb.conf to the options arangodb.hosts, arangodb.user, and arangodb.password I was able to solve the issue.

Below you can find my properties file which fixes the issue.

gremlin.graph = com.arangodb.tinkerpop.gremlin.structure.ArangoDBGraph
graph.db = GD_dev
graph.name = gremlin_demo
gremlin.arangodb.conf.arangodb.hosts = 127.0.0.1:8529
gremlin.arangodb.conf.arangodb.user = arangouser
gremlin.arangodb.conf.arangodb.password = arangouser
arcanefoam commented 5 years ago

Good to know, perhaps this needs better documentation in the README/WIKI?

agentS commented 5 years ago

That would be nice. :) I can add it to the wiki, if you want to.

arcanefoam commented 5 years ago

That would be awesome! The correct settings name should appear here: https://github.com/ArangoDB-Community/arangodb-tinkerpop-provider/wiki/Configuration :D

agentS commented 5 years ago

No problem!

I updated the example properties file in the configuration wiki page and I also added a complete example configuration to the Gremlin server wiki page.

arcanefoam commented 5 years ago

Thanks a lot for helping with this! :)