JanusGraph : Please add a key named “ConfigurationManagementGraph” to the “graphs”

≡放荡痞女 提交于 2019-11-29 16:10:15

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!