Skip to content

Commit 8ae1cf5

Browse files
committed
Update Gryo version used in config files. CTR.
Fixes #1219 Signed-off-by: Jason Plurad <pluradj@us.ibm.com>
1 parent 38d7454 commit 8ae1cf5

7 files changed

Lines changed: 42 additions & 22 deletions

File tree

docs/basics.adoc

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,13 @@ Configuring JanusGraph Server is accomplished through a JanusGraph Server yaml c
129129
graphs: {
130130
graph: conf/janusgraph-berkeleyje.properties
131131
}
132-
plugins:
133-
- janusgraph.imports
132+
scriptEngines: {
133+
gremlin-groovy: {
134+
plugins: { org.janusgraph.graphdb.tinkerpop.plugin.JanusGraphGremlinPlugin: {},
135+
org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
136+
org.apache.tinkerpop.gremlin.tinkergraph.jsr223.TinkerGraphGremlinPlugin: {},
137+
org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {classImports: [java.lang.Math], methodImports: [java.lang.Math#*]},
138+
org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: [scripts/empty-sample.groovy]}}}}
134139
...
135140
----
136141

@@ -863,21 +868,24 @@ host: localhost
863868
port: 8182
864869
graphs: {
865870
graph: conf/janusgraph.properties}
866-
plugins:
867-
- janusgraph.imports
868871
scriptEngines: {
869872
gremlin-groovy: {
870-
scripts: [scripts/janusgraph.groovy]}}
873+
plugins: { org.janusgraph.graphdb.tinkerpop.plugin.JanusGraphGremlinPlugin: {},
874+
org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
875+
org.apache.tinkerpop.gremlin.tinkergraph.jsr223.TinkerGraphGremlinPlugin: {},
876+
org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {classImports: [java.lang.Math], methodImports: [java.lang.Math#*]},
877+
org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: [scripts/empty-sample.groovy]}}}}
871878
serializers:
872-
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
873-
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }}
879+
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
880+
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { serializeResultToString: true }}
881+
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
874882
metrics: {
875883
slf4jReporter: {enabled: true, interval: 180000}}
876884
----
877885

878886
.There are several important parts to this configuration file as they relate to JanusGraph.
879887
. In the `graphs` map, there is a key called `graph` and its value is `conf/janusgraph.properties`. This tells Gremlin Server to instantiate a `Graph` instance called "graph" and use the `conf/janusgraph.properties` file to configure it. The "graph" key becomes the unique name for the `Graph` instance in Gremlin Server and it can be referenced as such in the scripts submitted to it.
880-
. In the `plugins` list, there is a reference to `janusgraph.imports`, which tells Gremlin Server to initialize the "JanusGraph Plugin". The "JanusGraph Plugin" will auto-import JanusGraph specific classes for usage in scripts.
888+
. In the `plugins` list, there is a reference to `JanusGraphGremlinPlugin`, which tells Gremlin Server to initialize the "JanusGraph Plugin". The "JanusGraph Plugin" will auto-import JanusGraph specific classes for usage in scripts.
881889
. Note the `scripts` key and the reference to `scripts/janusgraph.groovy`. This Groovy file is an initialization script for Gremlin Server and that particular ScriptEngine. Create `scripts/janusgraph.groovy` with the following contents:
882890

883891

@@ -911,8 +919,8 @@ $ bin/gremlin-server.sh conf/gremlin-server-janusgraph.yaml
911919
[INFO] GremlinExecutor - Initialized gremlin-groovy ScriptEngine with scripts/janusgraph.groovy
912920
[INFO] ServerGremlinExecutor - Initialized GremlinExecutor and configured ScriptEngines.
913921
[INFO] ServerGremlinExecutor - A GraphTraversalSource is now bound to [g] with graphtraversalsource[standardjanusgraph[berkeleyje:db/berkeley], standard]
914-
[INFO] AbstractChannelizer - Configured application/vnd.gremlin-v1.0+gryo with org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0
915-
[INFO] AbstractChannelizer - Configured application/vnd.gremlin-v1.0+gryo-stringd with org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0
922+
[INFO] AbstractChannelizer - Configured application/vnd.gremlin-v3.0+gryo with org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0
923+
[INFO] AbstractChannelizer - Configured application/vnd.gremlin-v3.0+gryo-stringd with org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0
916924
[INFO] GremlinServer$1 - Gremlin Server configured with worker thread pool of 1, gremlin pool of 8 and boss thread pool of 1.
917925
[INFO] GremlinServer$1 - Channel started at port 8182.
918926
----
@@ -931,12 +939,12 @@ IMPORTANT: A difference you should understand is that when working with JanusGra
931939
[source,java]
932940
----
933941
GryoMapper mapper = GryoMapper.build().addRegistry(JanusGraphIoRegistry.INSTANCE).create();
934-
Cluster cluster = Cluster.build().serializer(new GryoMessageSerializerV1d0(mapper)).create();
942+
Cluster cluster = Cluster.build().serializer(new GryoMessageSerializerV3d0(mapper)).create();
935943
Client client = cluster.connect();
936944
client.submit("g.V()").all().get();
937945
----
938946

939-
By adding the `JanusGraphIoRegistry` to the `org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0`, the driver will know how to properly deserialize custom data types returned by JanusGraph.
947+
By adding the `JanusGraphIoRegistry` to the `org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0`, the driver will know how to properly deserialize custom data types returned by JanusGraph.
940948

941949
=== Extending JanusGraph Server
942950

docs/cassandra.adoc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,15 @@ In this case, each Gremlin Server would be configured to connect to the Cassandr
101101
----
102102
...
103103
graphs: {
104-
g: conf/janusgraph-cql.properties}
105-
plugins:
106-
- janusgraph.imports
104+
g: conf/janusgraph-cql.properties
105+
}
106+
scriptEngines: {
107+
gremlin-groovy: {
108+
plugins: { org.janusgraph.graphdb.tinkerpop.plugin.JanusGraphGremlinPlugin: {},
109+
org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
110+
org.apache.tinkerpop.gremlin.tinkergraph.jsr223.TinkerGraphGremlinPlugin: {},
111+
org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {classImports: [java.lang.Math], methodImports: [java.lang.Math#*]},
112+
org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: [scripts/empty-sample.groovy]}}}}
107113
...
108114
----
109115
For more information about Gremlin Server see the http://tinkerpop.apache.org/docs/$MAVEN{tinkerpop.version}/reference#gremlin-server[Apache TinkerPop documentation]

docs/hbase.adoc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,15 @@ In this case, each Gremlin Server would be configured to connect to the HBase cl
6666
----
6767
...
6868
graphs: {
69-
g: conf/janusgraph-hbase.properties}
70-
plugins:
71-
- janusgraph.imports
69+
g: conf/janusgraph-hbase.properties
70+
}
71+
scriptEngines: {
72+
gremlin-groovy: {
73+
plugins: { org.janusgraph.graphdb.tinkerpop.plugin.JanusGraphGremlinPlugin: {},
74+
org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
75+
org.apache.tinkerpop.gremlin.tinkergraph.jsr223.TinkerGraphGremlinPlugin: {},
76+
org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {classImports: [java.lang.Math], methodImports: [java.lang.Math#*]},
77+
org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: [scripts/empty-sample.groovy]}}}}
7278
...
7379
----
7480

docs/multinodejanusgraphcluster.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,5 @@ port: 8182
105105
username: admin
106106
password: password
107107
connectionPool: { enableSsl: true }
108-
serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
108+
serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
109109
----
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
hosts: [localhost]
22
port: 8182
3-
serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
3+
serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
hosts: [localhost]
22
port: 8182
3-
serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }}
3+
serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { serializeResultToString: true }}

janusgraph-examples/example-remotegraph/conf/remote-objects.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
hosts: [127.0.0.1]
22
port: 8182
33
serializer: {
4-
className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0,
4+
className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0,
55
config: {
66
ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry]
77
}

0 commit comments

Comments
 (0)