如何使用Gremlin配置Cassandra db进行远程连接?不工作
问题描述:
我在节点Js中使用Cassandra DB,DSE图形,gremlin查询。我能够获得价值并访问本地主机上的数据库。每当我尝试连接到远程服务器(例如http://remoteservercassandra.in)都无法连接。我如何连接到远程服务器?如何使用Gremlin配置Cassandra db进行远程连接?不工作
我的代码是
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."
}
我怎样才能解决这个错误,以及如何连接到远程服务器?远程服务器正在运行并侦听正确的接口上
答
确认:
lsof -i:9042
乍一看,这看起来像一个RPC_ADRESS问题。
是的,远程服务器是这个12.234.78.134。 RPC_ADRESS如果我改变这个地址意味着我可以改变的地方? – Periyasamy