0

我在節點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." 
} 

我怎樣才能解決這個錯誤,以及如何連接到遠程服務器?遠程服務器正在運行並偵聽正確的接口上

回答

1

確認:

lsof -i:9042

乍一看,這看起來像一個RPC_ADRESS問題。

+0

是的,遠程服務器是這個12.234.78.134。 RPC_ADRESS如果我改變這個地址意味着我可以改變的地方? – Periyasamy

相關問題