gpt4 book ai didi

node.js - 错误 : connect ECONNREFUSED when trying to connect to remote gremlin server (TinkerPop3)

转载 作者:搜寻专家 更新时间:2023-11-01 00:23:24 25 4
gpt4 key购买 nike

我正在使用 gremlin-javascript访问远程 gremlin 服务器的模块。我在 app.js 中的代码:

var gremlin = require('gremlin-client');
var client = gremlin.createClient(8182, 'localhost');
var query = client.stream('g.V()');
query.on('data', function(result) {
console.log(result);
});
query.on('end', function() {
console.log("All results fetched");
});

这工作正常,所有查询都得到执行。但是,当我将“localhost”替换为我的远程服务器地址 - cbtitan.cloudapp.net 时,它会返回 ECONNREFUSED 错误。

我应该更改/做什么才能连接到该远程服务器?或者我应该更改该远程服务器中的任何配置吗?我被这个问题严重困住了,请帮帮我。提前致谢。

gremlin-server.yaml

host: localhost
port: 8182
threadPoolWorker: 1
gremlinPool: 8
scriptEvaluationTimeout: 30000
serializedResponseTimeout: 30000
channelizer: org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer
graphs: {
graph: conf/gremlin-server/titan-berkeleyje-server.properties}
plugins:
- aurelius.titan
scriptEngines: {
gremlin-groovy: {
imports: [java.lang.Math],
staticImports: [java.lang.Math.PI],
scripts: [scripts/empty-sample.groovy]},
nashorn: {
imports: [java.lang.Math],
staticImports: [java.lang.Math.PI]}}
serializers:
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { useMapperFromGraph: graph }}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0, config: { useMapperFromGraph: graph }}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, config: { useMapperFromGraph: graph }}
processors:
- { className: org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor, config: { sessionTimeout: 28800000 }}
metrics: {
consoleReporter: {enabled: true, interval: 180000},
csvReporter: {enabled: true, interval: 180000, fileName: /tmp/gremlin-server-metrics.csv},
jmxReporter: {enabled: true},
slf4jReporter: {enabled: true, interval: 180000},
gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
graphiteReporter: {enabled: false, interval: 180000}}
threadPoolBoss: 1
maxInitialLineLength: 4096
maxHeaderSize: 8192
maxChunkSize: 8192
maxContentLength: 65536
maxAccumulationBufferComponents: 1024
resultIterationBatchSize: 64
writeBufferHighWaterMark: 32768
writeBufferHighWaterMark: 65536
ssl: {
enabled: false}

最佳答案

gremlin-server.yaml 中,您需要进行一些更改。

您需要更新主机。默认值为 localhost,这意味着您只能从本地客户端连接。如果您想在所有接口(interface)上监听,您应该使用机器的 IP 地址或 0.0.0.0。

host: 0.0.0.0

您应该使用 WebSocketChannelizer 而不是 HttpChannelizergremlin-javascript 因为它是 TinkerPop3 Gremlin 服务器的 WebSocket JavaScript 客户端。

channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer

关于node.js - 错误 : connect ECONNREFUSED when trying to connect to remote gremlin server (TinkerPop3),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33295859/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com