我試圖運行https://github.com/hazelcast/hazelcast-nodejs-clientHazelcast客戶的NodeJS連接被拒絕
我得到一個連接被拒絕的錯誤的「使用客戶端」一節中所提供的基本示例代碼。我在我的Mac和我的個人電腦上都試過這個結果。他們正在運行Node v6.9.1。我沒有任何特殊的防火牆設置。甚至嘗試徹底轉動Windows防火牆。
有什麼我失蹤?
[DefaultLogger] WARN at ClientConnection: Could not connect to address localhost:5701
{ Error: connect ECONNREFUSED 127.0.0.1:5701
at Object.exports._errnoException (util.js:1026:11)
at exports._exceptionWithHostPort (util.js:1049:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1085:14)
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 5701 }
Unhandled rejection Error: Unable to connect to any of the following addresses: localhost:5701
at Immediate.<anonymous> (C:\Users\Jennie Lyn\node_modules\hazelcast-client\lib\invocation\ClusterService.js:95:33)
at runCallback (timers.js:637:20)
at tryOnImmediate (timers.js:610:5)
at processImmediate [as _immediateCallback] (timers.js:582:5)
首先我創建了一個空節點項目,然後:
npm install hazelcast-client --save
然後創建一個js文件有:
var HazelcastClient = require('hazelcast-client').Client;
var person = {
firstName: "Joe",
lastName: "Doe",
age: 42
};
var map;
HazelcastClient.newHazelcastClient().then(function (hazelcastClient) {
map = hazelcastClient.getMap("personMap");
map.put(1, person).then(function (val) {
// prints previous value for key `1`
console.log(val);
});
map.get(1).then(function (value) {
console.log(value);
})
});
這是所有的文件說做。是否還需要做其他事情才能在本地主機上使用hazelcast-client for nodejs啓動單個客戶端羣集?
也許聽起來很愚蠢,但羣集節點(一個或多個)正在運行? – noctarius
在文檔中給出的例子中,它默認不啓動單個節點實例嗎?如果不是如何啓動集羣? –