让Node.js客户端连接到gremlin服务器(所有服务器都在同一台服务器上运行)以进行CRUD操作的良好且可靠的做法
[在Ubuntu 18.04上] 我已经(并且被迫使用)janusgraph创建了一个角色库。我将使用graphDB,主要是因为角色关系与角色属性一样重要,并且结构需要是流动的。我需要创建一个Node.js应用程序(+pug&stylus),对graphDB中的数据执行CRUD操作,但我不知道如何将客户端连接到服务器。(研究表明了该问题的解决方案,但仅使用不同的组件—Neo4j、OrientDB等) 我可以成功启动gremlin服务器,然后我尝试创建一个gremlin控制台连接,如下所示让Node.js客户端连接到gremlin服务器(所有服务器都在同一台服务器上运行)以进行CRUD操作的良好且可靠的做法,node.js,connection,janusgraph,gremlin-server,Node.js,Connection,Janusgraph,Gremlin Server,[在Ubuntu 18.04上] 我已经(并且被迫使用)janusgraph创建了一个角色库。我将使用graphDB,主要是因为角色关系与角色属性一样重要,并且结构需要是流动的。我需要创建一个Node.js应用程序(+pug&stylus),对graphDB中的数据执行CRUD操作,但我不知道如何将客户端连接到服务器。(研究表明了该问题的解决方案,但仅使用不同的组件—Neo4j、OrientDB等) 我可以成功启动gremlin服务器,然后我尝试创建一个gremlin控制台连接,如下所示 /op
/opt/janusgraph-0.2.2-hadoop2/bin/gremlin.sh/opt/janusgraph-0.2.2-hadoop2/conf/gremlin-server/gremlin-server.yaml
yaml看起来像这样:
(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:/opt/janusgraph-0.2.2-hadoop2/lib/slf4j-log4j12-1.7.12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/janusgraph-0.2.2-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]
16:19:01 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
Error in /opt/janusgraph-0.2.2-hadoop2/conf/gremlin-server/gremlin-server.yaml at [1: host: [localhost]] - No such property: localhost for class: groovysh_evaluate
(除了localhost
,我还尝试了主机的特定IP地址,以及带方括号和不带方括号的两个选项,但结果相似)
stdout如下所示:
(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:/opt/janusgraph-0.2.2-hadoop2/lib/slf4j-log4j12-1.7.12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/janusgraph-0.2.2-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]
16:19:01 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
Error in /opt/janusgraph-0.2.2-hadoop2/conf/gremlin-server/gremlin-server.yaml at [1: host: [localhost]] - No such property: localhost for class: groovysh_evaluate
显然,我假设或配置了一些错误的东西,即使是在控制台到服务器yaml中,我也不知道相同的yaml文件是否适用于Node.js客户端连接
我想我需要控制台连接,这样我就可以从graphml文件导入初学者数据,然后从前端Node.js应用程序中创建新条目、查询条目、更新条目和删除条目
我需要做什么?以下操作不会创建从Gremlin控制台到Gremlin服务器的任何连接:
/opt/janusgraph-0.2.2-hadoop2/bin/gremlin.sh /opt/janusgraph-0.2.2-hadoop2/conf/gremlin-server/gremlin-server.yaml
gremlin.sh
不将gremlin服务器yaml文件作为参数。只需启动bin/gremlin.sh
,然后编写连接命令:
gremlin> :remote connect tinkerpop.server conf/remote.yaml
其中
remote.yaml
指向Gremlin服务器。您可以在不同的地方阅读更多关于这方面的详细信息,但我将向您介绍TinkerPop参考文档。谢谢。这使我忘记了这个问题。