【发布时间】:2019-12-11 14:00:52
【问题描述】:
首先,我按照以下步骤在 JanusGraph 中创建图表。
- 将以下内容添加到
conf/janusgraph-cassandra-configurationgraph.properties
index.search.backend = elasticsearch
index.search.hostname = 127.0.0.1
index.search.elasticsearch.transport-scheme = http
将 gremlin-server-configuration.yaml 中的“ConfigurationManagementGraph:conf/janusgraph-cql-configurationgraph.properties”更改为“ConfigurationManagementGraph:conf/janusgraph-cassandra-configurationgraph.properties”
将 conf/gremlin-server/gremlin-server.yaml 更改为 conf/gremlin-server/gremlin-server.yaml.orig
将 conf/gremlin-server/gremlin-server-configuration.yaml 更改为 conf/gremlin-server/gremlin-server.yaml
运行 bin/janusgraph.sh 启动
运行 bin/gremlin.sh
运行
:remote connect tinkerpop.server conf/remote.yaml session
:remote console
map = new HashMap<String, Object>();
map.put("storage.backend", "cassandrathrift");
map.put("storage.hostname", "127.0.0.1");
map.put("graph.graphname", "KG");
map.put("index.search.backend", "elasticsearch");
map.put("index.search.hostname", "127.0.0.1");
map.put("index.search.elasticsearch.transport-scheme", "http");
ConfiguredGraphFactory.createConfiguration(new MapConfiguration(map));
graph=ConfiguredGraphFactory.open("KG");
g=graph.traversal();
ConfiguredGraphFactory.getGraphNames()
关闭janusgraph,运行bin/janusgraph.sh stop
将 conf/janusgraph-cassandra-es.properties 复制到 conf/KG.properties
将以下两行添加到conf/KG.properties的顶部
gremlin.graph=org.janusgraph.core.ConfiguredGraphFactory
graph.graphname=KG
- 打开 conf/gremlin-server/gremlin-server.yaml,并将以下行添加到图表中:
KG: conf/KG.properties
将“scripts/empty-sample.groovy”添加到“org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin:”
打开script/empty-sample.groovy,把最后一行改成如下:
globals << [g : KG.traversal()]
- 通过运行 bin/janusgraph.sh start 再次启动 janusgraph
其次,我运行 bin/gremlin.sh
- 运行
:remote connect tinkerpop.server conf/remote.yaml session
:remote console
graph=ConfiguredGraphFactory.open("KG");
g=graph.traversal();
g.addV('user').property('name', 'Robert')
g.V()
- 我可以看到它返回一个顶点
==>v[4120]
然而,第三,当我从 gremlin 控制台退出并再次像上面一样进入 gremlin 控制台时,当我尝试查询 g.V() 时,我没有看到任何返回。
知道为什么会这样吗?非常感谢!
【问题讨论】:
标签: gremlin tinkerpop janusgraph gremlin-server