manasa
manasa

Reputation: 21

Error: connect ECONNREFUSED when trying to connect to remote gremlin server (TinkerPop3)

Im using gremlin-javascript module to access a remote gremlin server. My code in 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");
});

This works fine and all queries are getting executed. But when i replace 'localhost' with my remote server address - cbtitan.cloudapp.net, its giving back ECONNREFUSED error.

what should i change/do to connect to that remote server? or Should i change any configuration in that remote server ? I'm badly stuck with this problem, please help me out. Thanks in advance.

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}

Upvotes: 2

Views: 1741

Answers (1)

Jason Plurad
Jason Plurad

Reputation: 6792

In the gremlin-server.yaml, you need to make a couple changes.

You need to update the host. The default is localhost, which means you can only connect from a local client. You should either use the IP address of the machine or 0.0.0.0 if you want to listen on all interfaces.

host: 0.0.0.0

You should be using WebSocketChannelizer instead of HttpChannelizer with gremlin-javascript because it is a WebSocket JavaScript client for TinkerPop3 Gremlin Server.

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

Upvotes: 5

Related Questions