Error Connecting with Tinkerpop gremlin #206
-
|
I'm trying to connect to Arcade DB with the gremlin tinkerpop api remotely. I'm not sure what I am missing. I've been able to connect to orientdb successfully using the tinker tinkerpop api and would like to be able to reuse the rest of my code i had for OrientDB. I'm creating the traversal like this: import org.apache.tinkerpop.gremlin.driver.Cluster;
import org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteConnection;
import org.apache.tinkerpop.gremlin.process.traversal.AnonymousTraversalSource;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
var cluster = Cluster.build()
.addContactPoint("localhost")
.port(8182) // also tried port 2480
.credentials(user, password)
.create();
var g = AnonymousTraversalSource.traversal().withRemote(DriverRemoteConnection.using(cluster));
// i want to run command like this
g.V().toList();I'm starting the ArcadeDB up with docker as such docker run -d --name arcadeDb `
-p 2424:2424 -p 2480:2480 -p 8182:8182 `
-e "arcadedb.server.rootPassword=passwordhere" `
-e "arcadedb.server.defaultDatabases=Imported[root]{import:https://github.com/ArcadeData/arcadedb-datasets/raw/main/orientdb/OpenBeer.gz}" `
arcadedata/arcadedb:latestThere error i am getting is: What am I missing? Is there a better way? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 14 replies
-
|
How did you run the Gremlin server with OrientDB? |
Beta Was this translation helpful? Give feedback.
-
|
Try passing gremlin.host without the arcadedb prefix |
Beta Was this translation helpful? Give feedback.
-
|
I've created a PR to fix this issue: |
Beta Was this translation helpful? Give feedback.
-
|
The working configuration is the following: gremlin-server.yaml: host: 0.0.0.0
graphs:
graph: ./target/config/gremlin-server.properties
scriptEngines:
gremlin-groovy:
plugins:
org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {}
org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin:
classImports:
- java.lang.Math
methodImports:
- 'java.lang.Math#*'
org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin:
files:
- ./target/config/gremlin-server.groovy
serializers:
- className: org.apache.tinkerpop.gremlin.driver.ser.GraphBinaryMessageSerializerV1
config:
ioRegistries:
- org.apache.tinkerpop.gremlin.arcadedb.structure.io.ArcadeIoRegistrygremlin-server.properties: gremlin-server.groovy (used by Gremlin Server to register the graph instance): import org.apache.tinkerpop.gremlin.server.util.LifeCycleHook
def globals = [:]
// defines a sample LifeCycleHook that prints some output to the Gremlin Server console.
// note that the name of the key in the "global" map is unimportant.
globals << [hook : [
onStartUp: { ctx ->
ctx.logger.info("Executed once at startup of Gremlin Server.")
},
onShutDown: { ctx ->
ctx.logger.info("Executed once at shutdown of Gremlin Server.")
}
] as LifeCycleHook]
// define the default TraversalSource to bind queries to - this one will be named "g".
globals << [graph : graph.traversal()]Code: @Test
public void getAllVertices() {
final GraphTraversalSource g = traversal();
var vertices = g.V().limit(3).toList();
Assertions.assertEquals(3, vertices.size());
}
private Cluster createCluster() {
final GraphBinaryMessageSerializerV1 serializer = new GraphBinaryMessageSerializerV1(
new TypeSerializerRegistry.Builder().addRegistry(new ArcadeIoRegistry()));
return Cluster.build().enableSsl(false).addContactPoint("localhost").port(8182).credentials("root", DEFAULT_PASSWORD_FOR_TESTS).serializer(serializer)
.create();
}
private GraphTraversalSource traversal() {
return AnonymousTraversalSource.traversal().withRemote(DriverRemoteConnection.using(createCluster(), "graph"));
} |
Beta Was this translation helpful? Give feedback.
The working configuration is the following:
gremlin-server.yaml: