【发布时间】: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