Meteorhack:群集订阅呼叫失败

时间:2015-12-13 21:31:46

标签: meteor cluster-computing ddp

我在端口8001上有一个UI应用程序,在端口7001上有一个名为contract的应用程序。我有' cluster'安装和工作。我在'合同'中定义了订阅和插入方法。应用程序。

'合同'服务器/ app.js

Traceback (most recent call last):
  File "pythonServer.py", line 3, in <module>
    response = urllib.urlopen(url)
  File "/usr/lib/python2.7/urllib.py", line 87, in urlopen
    return opener.open(url)
  File "/usr/lib/python2.7/urllib.py", line 213, in open
    return getattr(self, name)(url)
  File "/usr/lib/python2.7/urllib.py", line 350, in open_http
    h.endheaders(data)
  File "/usr/lib/python2.7/httplib.py", line 997, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 850, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 812, in send
    self.connect()
  File "/usr/lib/python2.7/httplib.py", line 793, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python2.7/socket.py", line 571, in create_connection
    raise err
IOError: [Errno socket error] [Errno 111] Connection refused

我在UI应用程序中从角度控制器访问方法。

UI app server / app.js
Cluster.connect("mongodb://<username>:<passwd>@URL");
var options = {
    endpoint: "http://localhost:7001",
    balancer: "http://localhost:7001", // optional
    uiService: "web" // (optional) read to the end for more info
};
Cluster.register("contracts", options);

var Contracts = new Meteor.Collection('contracts');

Meteor.methods({
    addContract: addContract,
    findContracts: findContracts
});

Meteor.publish("getContracts", function () {
    return Contracts.find({});
});

function addContract(c){
    var data = {
        id: c.id,
        type: c.type
    };
    Contracts.insert(data);
}

function findContracts(){
    var contracts = Contracts.find().fetch();
    return contracts;
}
UI app控制器代码
Cluster.connect(mongodb://<username>:<passwd>@URL");
var options = {
    endpoint: "http://localhost:8001",
    balancer: "http://localhost:8001" // optional
    //uiService: "web" // (optional) read to the end for more info
};
Cluster.register("web", options);
Cluster.allowPublicAccess("contracts");

这是发生的事情: *我可以访问合同服务器上的方法 *我可以使用这些方法插入或查找合同 *我的订阅无效。光标上的提取显示0,计数显示0 *连接状态显示&#39;连接&#39;

我的订阅错误是什么?

苏迪

1 个答案:

答案 0 :(得分:0)

我必须将客户端mongo集合的名称更改为与服务上的集合名称相同的名称。