简体   繁体   English

如何使用gremlin python连接到远程Neo4j数据库?

[英]How do I connect to a remote Neo4j database using gremlin python?

From what I've read Neo4j implements apache tinkerpop which leads me to think I can use gremlin python and rather than connect to a gremlin server I can point the python code at a neo4j server and treat it like a gremlin server. 从我看过的文章中,Neo4j实现了apache tinkerpop,这使我认为我可以使用gremlin python,而不是连接到gremlin服务器,我可以将python代码指向neo4j服务器,并将其视为gremlin服务器。

However I can't find any information online which shows how to do this so I'm thinking maybe I've misunderstood something. 但是,我在网上找不到任何信息来显示如何执行此操作,因此我认为我可能误解了一些信息。

  • a) Can I use gremlin python directly with a neo4j db instance? a)我可以直接在neo4j数据库实例中使用gremlin python吗?
  • b) If yes to (a) then how? b)如果(a)是,那么如何?

Thanks 谢谢

Alex 亚历克斯

You can not connect gremlin-python to Neo4j Server. 您无法将gremlin-python连接到Neo4j Server。 gremlin-python contains drivers that connect to Gremlin Server so you must have that installed for gremlin-python to work. gremlin-python包含连接到Gremlin Server的驱动程序,因此必须安装该驱动程序才能使gremlin-python正常工作。 Given that you need Gremlin Server you must choose one of the following options all of which are just Gremlin Server configurations: 考虑到您需要Gremlin Server,您必须选择以下选项之一,所有这些只是Gremlin Server配置:

  1. Configure Neo4j in embedded mode within Gremlin Server. 在Gremlin Server中以嵌入式模式配置Neo4j。 An example of this is here where that file points to a Neo4j configuration file . 此处的一个示例是该文件指向Neo4j 配置文件 Note that these files are packaged in the Gremlin Server distribution as samples so you can run them directly quite easily. 请注意,这些文件作为示例打包在Gremlin Server发行版中,因此您可以非常轻松地直接运行它们。
  2. Modify the aforementioned Neo4j configuration file to run Neo4j in HA mode effectively turning Gremlin Server into a node in the Neo4j cluster. 修改上述Neo4j配置文件以在HA模式下运行Neo4j,从而有效地将Gremlin Server转变为Neo4j集群中的一个节点。
  3. Configure a neo4j-gremlin-bolt instance which will use the Neo4j Bolt protocol to connect to the running Neo4j Server. 配置一个neo4j-gremlin-bolt实例,该实例将使用Neo4j Bolt协议连接到正在运行的Neo4j Server。 While I"m not completely familiar with this implementation, I can see that you would change the gremlin.graph to com.steelbridgelabs.oss.neo4j.structure.Neo4JGraph and that you would discern Bolt configuration options from this class (which instantiates that graph instance). 虽然我“米不完全熟悉此实现,我可以看到你会改变gremlin.graphcom.steelbridgelabs.oss.neo4j.structure.Neo4JGraph从和你会看出博尔特的配置选项这一类 (其实例化图实例)。

Once you've chosen one of those configuration options you can then use gremlin-python to work with Neo4j. 选择这些配置选项之一后,即可使用gremlin-python与Neo4j配合使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM