Skip to content
Nathan McCoy edited this page May 11, 2020 · 6 revisions

Gremlin Server

The Gremlin Server allows users to execute Gremlin against graph instances hosted remotely.

Using ArangoDB with the Gremlin Server

In order to use ArangoDB TinkerPop Provider with the Gremlin Server all that you need is to make the server aware of the ArangoDB Provider and provide a configuration file for your graph. The latter is explained in detail in the Configuration wiki.

To install the ArangoDB TinkerPop Provider use the install switch with the gremlin-server.sh script (or .bat in Windows) and provide the appropriate Maven coordinates:

bin/gremlin-server.sh install org.arangodb arangodb-tinkerpop-provider 2.0.2

This command will download the appropriate dependencies and copy them to the ext directory of Gremlin Server, which will make them available the next time the server is started. To uninstall dependencies, simply delete them from the ext directory (i.e. this is needed if you want to switch to a different version of the ArangoDB TinkerPop Provider).

Configuration File

The Gremlin Server is configured through a YAML file, as explained here. One of the settings of the file is the graphs key. The value of this key must be a a Map of Graph configuration files where the key of the Mapbecomes the name to which the Graph will be bound and the value is the file name of a Graph configuration file. For example, the following will declare a graph named modern:

...
graphs: {
  graph: some/path/modern-arangodb.properties}
...  

where the file modern-arangodb.properties would be the example properties file presented in the Configuration wiki.

Example Configuration File

The code below shows a full configuration file for Gremlin server. The configuration makes the ArangoDB modern database available as traversal source named modern.

host: localhost
port: 8182
scriptEvaluationTimeout: 30000
channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer
graphs: {
  graph: some/path/modern-arangodb.properties}
scriptEngines: {
  gremlin-groovy: {
    plugins: { org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
               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}