Peri
Peri

Reputation: 158

How to configure Cassandra db using Gremlin for remote connection? Not working

I am using Cassandra DB, DSE graph, gremlin query in Node Js. I able to get value and access the DB in localhost. whenever I tried to connect to a remote server(For Example http://remoteservercassandra.in) can't able to connect. How can I connect to the remote server?

My code is

var dse = require('dse-driver');

var client = new dse.Client({
   contactPoints: ['127.0.0.1'],
    authProvider: new dse.auth.DsePlainTextAuthProvider('username','password'),
   protocolOptions: {
     port: 9042
   },
   graphOptions: {
    name: 'mygraphname'
   }
});

When I tried it getting this error

{
    "innerErrors": null,
    "info": "Represents an error when a query cannot be performed because no host is available or could be reached by the driver.",
    "message": "No host could be resolved"
}

If I tried to connect my remote server URL (For Example http://remoteservercassandra.in) I am getting this error.

var dse = require('dse-driver');

var client = new dse.Client({
   contactPoints: ['remoteservercassandra.in'],
    authProvider: new dse.auth.DsePlainTextAuthProvider('username','password'),
   protocolOptions: {
     port: 9042
   },
   graphOptions: {
    name: 'mygraphname'
   }
});

I am getting this error.

{
    "innerErrors": {
        "12.234.78.134:9042": { // based on host name this IP address
            "code": "ECONNREFUSED",
            "errno": "ECONNREFUSED",
            "syscall": "connect",
            "address": "12.234.78.134",
            "port": 9042
        }
    },
    "info": "Represents an error when a query cannot be performed because no host is available or could be reached by the driver.",
    "message": "All host(s) tried for query failed. First host tried, 12.234.78.134:9042: Error: connect ECONNREFUSED 12.234.78.134:9042. See innerErrors."
}

How can I solve this error and how to connect to remote server?

Upvotes: 0

Views: 312

Answers (1)

phact
phact

Reputation: 7305

Confirm that the remote server is running and listening on the right interface:

lsof -i:9042

At first glance this looks like an RPC_ADRESS problem.

Upvotes: 1

Related Questions