Answer a question

I'm trying to connect to replica set from Ubuntu using this:

return when.promise(function(resolve,reject){
        new MongoClient().connect(url, {replSet: options }, function(err, db){
        console.dir(err)
        if (err)
            reject(err);

        resolve(db);
    });
});

Url looks like this:

'mongodb://mongo1.mysite.com:36108,mongo2.mysite.com:36108,mongo3.mysite.com:36108/db_config?w=0'

I'm connection to multiple databases and intermittently i see this error:

{ name: 'MongoError', message: 'no valid seed servers in list' }

And node.js crashes.

I'm kind of lost at this point. And the main problem is that it works perfectly on MAC and i see this issue only on Ubuntu. I'm on the latest mongo driver for node.js

UPDATE

I took a look at the native driver source:

http://mongodb.github.io/node-mongodb-native/core/api/replset.js.html

and found out tha error being triggered by this condition (line 987): state.initialConnectionServers == 0 && state.replState.state == CONNECTING)

Still not sure why is this happening.

Answers

Increasing the amount of file descriptors solved the issue.

On Ubuntu 12.04.5 LTS default is 1024 which is not enough.

Logo

MongoDB社区为您提供最前沿的新闻资讯和知识内容

更多推荐