JanusGraph : Please add a key named "ConfigurationManagementGraph" to the "graphs"
Asked Answered
G

1

6

I get the this error in gremlin console

cegprakash@cegprakash:~/workspace/janusgraph-0.2.1-hadoop2$ ./bin/gremlin.sh 

         \,,,/
         (o o)
-----oOOo-(3)-oOOo-----
plugin activated: janusgraph.imports
plugin activated: tinkerpop.server
plugin activated: tinkerpop.utilities
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/cegprakash/workspace/janusgraph-0.2.1-hadoop2/lib/slf4j-log4j12-1.7.12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/cegprakash/workspace/janusgraph-0.2.1-hadoop2/lib/logback-classic-1.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
19:10:12 WARN  org.apache.hadoop.util.NativeCodeLoader  - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
plugin activated: tinkerpop.hadoop
plugin activated: tinkerpop.spark
plugin activated: tinkerpop.tinkergraph
gremlin> def graph=ConfiguredGraphFactory.create("mygraph")
org.janusgraph.graphdb.management.utils.ConfigurationManagementGraphNotEnabledException: Please add a key named "ConfigurationManagementGraph" to the "graphs" property in your YAML file and restart the server to be able to use the functionality of the ConfigurationManagementGraph class.
Type ':help' or ':h' for help.
Display stack trace? [yN]

Edit: I also followed Jason Plurad's steps in the answer.

conf/gremlin-server/gremlin-server.yaml

host: 0.0.0.0
port: 8182
scriptEvaluationTimeout: 30000
channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer
graphs: {
  ConfigurationManagementGraph: conf/janusgraph-cassandra-configurationgraph.properties
}
plugins:
  - janusgraph.imports
scriptEngines: {
  gremlin-groovy: {
    imports: [java.lang.Math],
    staticImports: [java.lang.Math.PI],
    scripts: [scripts/empty-sample.groovy]}}
serializers:
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoLiteMessageSerializerV1d0, config: {ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistryV1d0] }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
  - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistryV1d0] }}
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},
  gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
  graphiteReporter: {enabled: false, interval: 180000}}
maxInitialLineLength: 4096
maxHeaderSize: 8192
maxChunkSize: 8192
maxContentLength: 65536
maxAccumulationBufferComponents: 1024
resultIterationBatchSize: 64
writeBufferLowWaterMark: 32768
writeBufferHighWaterMark: 65536

Here is my janusgraph-cassandra-configurationgraph.properties file

gremlin.graph=org.janusgraph.core.ConfiguredGraphFactory
graph.graphname=ConfigurationManagementGraph
storage.backend=cassandrathrift
storage.hostname=127.0.0.1
cache.db-cache = true
cache.db-cache-clean-wait = 20
cache.db-cache-time = 180000
cache.db-cache-size = 0.5

Then I did

./bin/janusgraph.sh clean
Are you sure you want to delete all stored data and logs? [y/N] y
Deleted data in /home/cegprakash/workspace/janusgraph-0.2.1-hadoop2/db
Deleted logs in /home/cegprakash/workspace/janusgraph-0.2.1-hadoop2/log

followed by

cegprakash@cegprakash:~/workspace/janusgraph-0.2.1-hadoop2$ ./bin/janusgraph.sh start
Forking Cassandra...
Running `nodetool statusthrift`.... OK (returned exit status 0 and printed string "running").
Forking Elasticsearch...
Connecting to Elasticsearch (127.0.0.1:9200)....... OK (connected to 127.0.0.1:9200).
Forking Gremlin-Server...
Connecting to Gremlin-Server (127.0.0.1:8182)..... OK (connected to 127.0.0.1:8182).
Run gremlin.sh to connect.

followed by

cegprakash@cegprakash:~/workspace/janusgraph-0.2.1-hadoop2$ ./bin/gremlin.sh 

         \,,,/
         (o o)
-----oOOo-(3)-oOOo-----
plugin activated: janusgraph.imports
plugin activated: tinkerpop.server
plugin activated: tinkerpop.utilities
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/cegprakash/workspace/janusgraph-0.2.1-hadoop2/lib/slf4j-log4j12-1.7.12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/cegprakash/workspace/janusgraph-0.2.1-hadoop2/lib/logback-classic-1.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
19:35:47 WARN  org.apache.hadoop.util.NativeCodeLoader  - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
plugin activated: tinkerpop.hadoop
plugin activated: tinkerpop.spark
plugin activated: tinkerpop.tinkergraph
gremlin> :remote connect tinkerpop.server conf/remote.yaml session
==>Configured localhost/127.0.0.1:8182-[14455470-addc-49ed-ae54-a30de1fd8ae8]
gremlin> :remote console
==>All scripts will now be sent to Gremlin Server - [localhost/127.0.0.1:8182]-[14455470-addc-49ed-ae54-a30de1fd8ae8] - type ':remote console' to return to local mode
gremlin> def graph=ConfiguredGraphFactory.create("mygraph")
Please add a key named "ConfigurationManagementGraph" to the "graphs" property in your YAML file and restart the server to be able to use the functionality of the ConfigurationManagementGraph class.
Type ':help' or ':h' for help.
Display stack trace? [yN]
Guyguyana answered 30/7, 2018 at 13:14 Comment(8)
There was an error Stop services before starting when you tried to start the server, but you continued on, leading to more downstream errors. You should make sure those Java processes are all terminated before starting. Try running bin/jansugraph.sh stop first, then verify with a ps -ef that you don't have any JanusGraph-related java processes running before continuing with the gist I provided.Thyroid
I did stop, clean and start, still the same warning and same errorGuyguyana
You'd need to kill those Java processes.Thyroid
Yes already did thatGuyguyana
Are you still getting Stop services before starting? You didn't update your results.Thyroid
I don't. Updated it.Guyguyana
after starting with bin/janusgraph.sh start what do you see here $ ls db/cassandra/data/Thyroid
Let us continue this discussion in chat.Thyroid
T
7

There are a few things that you may have missed or perhaps are not clear in the ConfiguredGraphFactory docs:

ConfiguredGraphFactory is used with a Gremlin Server, so you need to first make a remote connection. You should establish a sessioned remote connection, otherwise all of your template commands must be done in a single line request. When you interact with the ConfiguredGraphFactory from the Gremlin Console, you need to make sure you are sending your requests to the remote server. Typically you would do this by prepending your statements with :>. Alternatively, you could enter the remote console mode with :remote console which sends all commands to the remote server.

You didn't include the details of your janusgraph-cassandra.properties, but it would probably be best if you start with the configuration files that are packaged in the distribution. By default, the pre-packaged distrubtion does not use the ConfiguredGraphFactory, so here are some steps you can take to try it out.

# clean out any previous runs
bin/janusgraph.sh clean
Are you sure you want to delete all stored data and logs? [y/N] y
Deleted data in /opt/janusgraph-0.2.1-hadoop2/db
Deleted logs in /opt/janusgraph-0.2.1-hadoop2/log

# backup the default Gremlin Server configuration
cp conf/gremlin-server/gremlin-server.yaml conf/gremlin-server/gremlin-server.yaml.orig

# make the ConfiguredGraphFactory configuration the default
cp conf/gremlin-server/gremlin-server-configuration.yaml conf/gremlin-server/gremlin-server.yaml

# start Cassandra, Elasticsearch, Gremlin Server
bin/janusgraph.sh start

# start Gremlin Console
bin/gremlin.sh

Be aware that gremlin-server.yaml and gremlin-server-configuration.yaml have significant differences. Refer to the docs in Chapter 8.7: Configuring JanusGraph Server for ConfiguredGraphFactory.

In particular, gremlin-server-configuration.yaml defines:

graphs: {
  ConfigurationManagementGraph: conf/janusgraph-cql-configurationgraph.properties
}

And conf/janusgraph-cql-configurationgraph.properties defines:

graph.graphname=ConfigurationManagementGraph

In your post, you are most likely getting an error because conf/janusgraph-cassandra.properties does not contain the correct graph.graphname.

From this point, you can continue with the example Gremlin Console session listed here https://docs.janusgraph.org/latest/configuredgraphfactory.html#examples. As mentioned previously, the first two commands in the example are to establish the remote sessioned connection and to set the remote console mode:

gremlin> :remote connect tinkerpop.server conf/remote.yaml session
==>Configured localhost/127.0.0.1:8182

gremlin> :remote console
==>All scripts will now be sent to Gremlin Server - [localhost:8182]-[5206cdde-b231-41fa-9e6c-69feac0fe2b2] - type ':remote console' to return to local mode

I've created a full gist that shows all the steps on how to do this.

Thyroid answered 31/7, 2018 at 22:9 Comment(5)
I did all these steps. I still get the same error. Please check the updates in the question. Why is a graph creation so hard?Guyguyana
I don't think you follow my steps exactly. Please refer to the gist I referred to in my updated answer.Thyroid
If you don't need to create a graph dynamically, you can perhaps more easily use a statically defined graph. Just use the configuration out-of-the-box and it creates a graph in cassandra in the default keyspace named janusgraph. This is described in Chapter 7 docs.janusgraph.org/0.2.1/…Thyroid
I understand your frustration, but 'd prefer to keep this public for the benefit of the community. If you happen to work for the same company as me, you could send me an email from your corporate email address.Thyroid
Followed all the steps still getting the following error: Please add a key named "ConfigurationManagementGraph" to the "graphs" property in your YAML file and restart the server to be able to use the functionality of the ConfigurationManagementGraph class. Type ':help' or ':h' for help.Unbound

© 2022 - 2024 — McMap. All rights reserved.