在JanusGraph服务器上无法从.NET客户端看到带有BerkeleyDB存储的图形。

问题描述 投票:0回答:1

谁能帮我理解为什么我看不到JanusGraph.Net客户端的图表?

我正在运行最新的 Docker镜像 的JanusGraph,来自Docker Hub。在使用内置的控制台连接到JanusGraph后,我创建了一个样本Graph of the Gods,并能够使用以下命令查询它。

graph = JanusGraphFactory.open('conf/janusgraph-berkeleyje-lucene.properties')
GraphOfTheGodsFactory.load(graph)
g = graph.traversal()
g.V().count()

因为该图在容器重启后依然存在(能够再次查询)。 GraphOfTheGodsFactory.load(graph) 命令)和一些文件是在 /opt/janusgraph/db/berkeley/ 文件夹,我认为一切正常。

然后我更新了 graphs.graph 的财产 /opt/janusgraph/conf/gremlin-server/gremlin-server.yamldocker-entrypoint.sh)改为这个值。

graphs: {
  graph: conf/janusgraph-berkeleyje-lucene.properties
}

并重新启动容器。

之后,我使用以下方法创建了一个简单的.NET控制台应用程序 JanusGraph.Net 从与下面的代码。

static void Main(string[] args)
{
    var client = JanusGraphClientBuilder
       .BuildClientForServer(new GremlinServer("localhost", 8182))
       .Create();

    var g = AnonymousTraversalSource
       .Traversal()
       .WithRemote(new DriverRemoteConnection(client));

    var count = g.V().Count().Next();
}

count 变量始终为零。看起来我的.NET应用程序连接到这个服务器上的另一个(可能是内存中的)空图。

我还应该改变或更新什么?请帮忙弄清楚这个问题。

c# .net gremlin janusgraph gremlin-server
1个回答
2
投票

好吧,这不是很明显,但JanusGraph Docker镜像默认预配置为使用BerkeleyDB(BTW根据 文件 应该是Cassandra)。) 我是看了一下Gremlin Server的日志才发现的。Gremlin服务器被配置为使用 /etc/opt/janusgraph/janusgraph.properties 在启动时,这个文件包含了BerkeleyDB完全不同的配置。这个文件包含了BerkeleyDB的完全不同的配置,比如说。conf/janusgraph-berkeleyje.properties - 不同的文件夹等。这就是为什么我的.NET应用程序一直没有看到任何数据的原因--它(通过Gremlin Server)连接到了不同的BerkeleyDB数据库。

我也无法将这个文件加载到Gremlin控制台,通过 graph = JanusGraphFactory.open('/etc/opt/janusgraph/janusgraph.properties') - 了访问问题。当我把这个文件复制到 conf 目录(并改变了访问权限)--我得到了另一个错误。Could not instantiate implementation: org.janusgraph.diskstorage.berkeleyje.BerkeleyJEStoreManager 可能是因为BerkeleyDB已经存在。

所以我想出的唯一办法就是通过Gremlin Console连接到现有的数据库,就是使用 :remote connect 命令。我能够加载 "众神之图 "数据库样本,随后使用以下命令从我的.NET应用程序中访问它。

:remote connect tinkerpop.server conf/remote.yaml
:> GraphOfTheGodsFactory.load(graph)
:> g.V().count()
==>12
© www.soinside.com 2019 - 2024. All rights reserved.