How to load a graphml file into a remote instance of Janusgraph, from a local gremlin-console
Eventually, I want to create JanusGraph on a remote VM but for this PoT, I've created a local docker image with
docker run --rm --name janusgraph-default janusgraph/janusgraph:latest
Which works fine. I then started gremlin-console with:
docker run --rm --link janusgraph-default:janusgraph -e GREMLIN_REMOTE_HOSTS=janusgraph \ -it janusgraph/janusgraph:latest ./bin/gremlin.sh
This also works fine. On the gremlin-console I ran
:remote connect tinkerpop.server conf/remote.yaml
Then
:> g.addV('person').property('name', 'chris')
to test it had worked, I ran
:> g.V().values('name')
which returned chris
Having (I think) proved that gremlin-console can control the gremlin-server in the docker image, I wanted to import K Lawrence's air-routes-latest.graphml
, with a view to trying to create some CRUD operations in Node.js
All the docs I can find only deal with local import and not remote
I tried:
:> graph.io(graphml()).readGraph("/home/me/Downloads/air-routes.graphml")
, which returned
/home/me/Downloads/air-routes.graphml (No such file or directory)
Stack Trace:
Display stack trace? [yN]y
java.io.FileNotFoundException: /home/greg/Downloads/air-routes.graphml (No such file or directory)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:93)
at org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLIo.readGraph(GraphMLIo.java:91)
at org.apache.tinkerpop.gremlin.structure.io.Io$readGraph.call(Unknown Source)
at Script5.run(Script5.groovy:1)
at org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.eval(GremlinGroovyScriptEngine.java:674)
at org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine.eval(GremlinGroovyScriptEngine.java:376)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233)
at org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor.lambda$eval$0(GremlinExecutor.java:266)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
I'm confident that's really where it is (on the same machine as the console) but it made me wonder whether the import has a context of the remote server (in this case the docker image, but potentially a remote VM) or the local console? I can't find any help to shine a light on this help, please?
Gremlin.version()
==>3.4.4
gremlin-console janusgraph tinkerpop gremlin