【问题标题】:How to configure Cassandra db using Gremlin for remote connection? Not working如何使用 Gremlin 配置 Cassandra db 进行远程连接?不工作
【发布时间】:2018-03-23 02:53:51
【问题描述】:

我在 Node Js 中使用 Cassandra DB、DSE 图、gremlin 查询。我能够获得价值并访问本地主机中的数据库。每当我尝试连接到远程服务器(例如http://remoteservercassandra.in)时都无法连接。如何连接到远程服务器?

我的代码是

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'
   }
});

当我尝试它得到这个错误

{
    "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"
}

如果我尝试连接我的远程服务器 URL(例如 http://remoteservercassandra.in),我会收到此错误。

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'
   }
});

我收到此错误。

{
    "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."
}

我该如何解决这个错误以及如何连接到远程服务器?

【问题讨论】:

    标签: node.js cassandra datastax-enterprise gremlin spark-cassandra-connector


    【解决方案1】:

    确认远程服务器正在运行并在正确的接口上侦听:

    lsof -i:9042

    乍一看,这看起来像是一个 RPC_ADRESS 问题。

    【讨论】:

    • 是的,远程服务器就是12.234.78.134这个。 RPC_ADRESS 如果我更改此地址意味着我可以在哪里更改?
    猜你喜欢
    • 2016-07-08
    • 1970-01-01
    • 2018-06-21
    • 2016-09-02
    • 2018-02-20
    • 1970-01-01
    • 1970-01-01
    • 2014-07-28
    • 2015-07-10
    相关资源
    最近更新 更多