I’m running a dockerized meteor app (meteord image) via Tutum.co ( a platform as a service) using Microsoft Azure for the infrastructure. My Mongo db is running in Compose.io
The Meteor app is connected to the Mongo DB via the env variable:
MONGO_URL mongodb://user:pass@lamppost.11.mongolayer.com:10199,lamppost.10.mongolayer.com:10217/testdb?replicaSet=set-5593a9752debaf23ed000477
And this works fine.
If I try to add the METEOR_OPLOG_URL env variable with the value
The user has oplog access.
The database is hosted by Compose.io in AWS Ireland zone. The errors are happening with the meteor app in Azure datacenters (I tried Amsterdam and Ireland).
I added the meteor app in AWS Ireland, it worked from there. (without changing anything in the env variables for METEOR) Also running the app locally (via docker) works OK! But we want to use Azure. Anybody else running in this config? Azure + Compose?
kompas-test-web-4 | 2015-08-12T15:28:02.438069500Z Exception in setInterval callback: Error: failed to connect to [lamppost.11.mongolayer.com:10199]
kompas-test-web-4 | 2015-08-12T15:28:02.438069500Z at Object.Future.wait (/built_app/programs/server/node_modules/fibers/future.js:398:15)
kompas-test-web-4 | 2015-08-12T15:28:02.438069500Z at [object Object].<anonymous> (packages/meteor/helpers.js:119:1)
kompas-test-web-4 | 2015-08-12T15:28:02.438069500Z at [object Object].MongoConnection.(anonymous function) [as remove] (packages/mongo/mongo_driver.js:678:1)
kompas-test-web-4 | 2015-08-12T15:28:02.438069500Z at [object Object].Mongo.Collection.(anonymous function) [as remove] (packages/mongo/collection.js:575:1)
kompas-test-web-4 | 2015-08-12T15:28:02.438069500Z at _cleanStaleResults (packages/oauth/pending_credentials.js:30:1)
kompas-test-web-4 | 2015-08-12T15:28:02.438069500Z at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
kompas-test-web-4 | 2015-08-12T15:28:02.438069500Z at packages/meteor/timers.js:6:1
kompas-test-web-4 | 2015-08-12T15:28:02.438069500Z at runWithEnvironment (packages/meteor/dynamics_nodejs.js:108:1)
kompas-test-web-3 | 2015-08-12T15:20:19.988757700Z Error: No primary found in set
kompas-test-web-3 | 2015-08-12T15:20:19.988757700Z at Object.Future.wait (/built_app/programs/server/node_modules/fibers/future.js:398:15)
kompas-test-web-3 | 2015-08-12T15:20:19.988757700Z at new MongoConnection (packages/mongo/mongo_driver.js:213:1)
kompas-test-web-3 | 2015-08-12T15:20:19.988757700Z at new MongoInternals.RemoteCollectionDriver (packages/mongo/remote_collection_driver.js:4:1)
kompas-test-web-3 | 2015-08-12T15:20:19.988757700Z at Object.<anonymous> (packages/mongo/remote_collection_driver.js:38:1)
kompas-test-web-3 | 2015-08-12T15:20:19.988757700Z at Object.defaultRemoteCollectionDriver (packages/underscore/underscore.js:750:1)
kompas-test-web-3 | 2015-08-12T15:20:19.988757700Z at new Mongo.Collection (packages/mongo/collection.js:98:1)
kompas-test-web-3 | 2015-08-12T15:20:19.988757700Z at packages/accounts-base/accounts_common.js:141:1
kompas-test-web-3 | 2015-08-12T15:20:19.988757700Z at /built_app/programs/server/packages/accounts-base.js:243:4
kompas-test-web-3 | 2015-08-12T15:20:19.988757700Z at /built_app/programs/server/packages/accounts-base.js:1659:3
kompas-test-web-3 | 2015-08-12T15:20:19.988757700Z at /built_app/programs/server/boot.js:222:10
kompas-test-web-6 | 2015-08-12T15:20:26.778887200Z Error: No valid replicaset instance servers found
kompas-test-web-6 | 2015-08-12T15:20:26.778887200Z at Object.Future.wait (/built_app/programs/server/node_modules/fibers/future.js:398:15)
kompas-test-web-6 | 2015-08-12T15:20:26.778887200Z at new MongoConnection (packages/mongo/mongo_driver.js:213:1)
kompas-test-web-6 | 2015-08-12T15:20:26.778887200Z at new MongoInternals.RemoteCollectionDriver (packages/mongo/remote_collection_driver.js:4:1)
kompas-test-web-6 | 2015-08-12T15:20:26.778887200Z at Object.<anonymous> (packages/mongo/remote_collection_driver.js:38:1)
kompas-test-web-6 | 2015-08-12T15:20:26.778887200Z at Object.defaultRemoteCollectionDriver (packages/underscore/underscore.js:750:1)
kompas-test-web-6 | 2015-08-12T15:20:26.778887200Z at new Mongo.Collection (packages/mongo/collection.js:98:1)
kompas-test-web-6 | 2015-08-12T15:20:26.778887200Z at packages/accounts-base/accounts_common.js:141:1
kompas-test-web-6 | 2015-08-12T15:20:26.778887200Z at /built_app/programs/server/packages/accounts-base.js:243:4
kompas-test-web-6 | 2015-08-12T15:20:26.778887200Z at /built_app/programs/server/packages/accounts-base.js:1659:3
kompas-test-web-6 | 2015-08-12T15:20:26.778887200Z at /built_app/programs/server/boot.js:222:10
The behaviour is very strange and sporadic, after a successful login everything works and you can continue working for a while, but then it breaks and the logs spit out can’t connect. After the connection issues you can’t login and everything related to the DB seems to be non functional. As if the connection was just dropped without reason and is not able to reconnect.
I am running a pure node app on another azure instance using mongoose and Compose.io almost the same issues were occurring and support from compose suggested that I enable “keep alive” in mongoose and that fixed the problem. So this might be related?
I finally found the solution! It has to do with Azure having some kind of idle time policy.
Adding a few options to my mongo url connection did the trick:
PS: adding options for readPreference and majority also solved meteor connection problem when primary is down and replicaSet elects new primary.
Hope this helps!
Sorry to awaken this, but I’m getting this error on Galaxy in my app. Seems related. I’m going to try the above tip with adding the options to the mongo URL. Will report back the results. I’m on Meteor 1.2.1. Mongo is hosted at compose.io Also, in the line replicaSet=mongors in the above Oplog URL, should that be set to the same value as the Mongo URL replicaSet?
2017-04-05 15:39:23-07:00Exception in setInterval callback: Error: failed to connect to [c1005.candidate.64.mongolayer.com:11005]
jtg7
2017-04-05 15:39:23-07:00 at Object.Future.wait (/app/bundle/programs/server/node_modules/fibers/future.js:398:15)
jtg7
2017-04-05 15:39:23-07:00 at [object Object]._.extend._nextObject (packages/mongo/packages/mongo.js:994:1)
jtg7
2017-04-05 15:39:23-07:00 at [object Object]._.extend.forEach (packages/mongo/packages/mongo.js:1028:1)
jtg7
2017-04-05 15:39:23-07:00 at [object Object]._.extend.map (packages/mongo/packages/mongo.js:1038:1)
jtg7
2017-04-05 15:39:23-07:00 at [object Object]._.extend.fetch (packages/mongo/packages/mongo.js:1062:1)
jtg7
2017-04-05 15:39:23-07:00 at [object Object].Cursor.(anonymous function) (packages/mongo/packages/mongo.js:877:1)
jtg7
2017-04-05 15:39:23-07:00 at [object Object].cursorProto.(anonymous function) (packages/meteorhacks_kadira/packages/meteorhacks_kadira.js:2996:1)
jtg7
2017-04-05 15:39:23-07:00 at [object Object].kadira_Cursor_fetch [as fetch] (packages/meteorhacks_kadira/packages/meteorhacks_kadira.js:3377:1)
jtg7
2017-04-05 15:39:23-07:00 at after (packages/matb33_collection-hooks/packages/matb33_collection-hooks.js:369:1)
jtg7
2017-04-05 15:39:23-07:00 at Object.fields (packages/matb33_collection-hooks/packages/matb33_collection-hooks.js:392:1)
jtg7
2017-04-05 15:39:23-07:00 - - - - -
jtg7
2017-04-05 15:39:23-07:00 at [object Object].<anonymous> (/app/bundle/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/connection/server.js:556:74)
jtg7
2017-04-05 15:39:23-07:00 at [object Object].emit (events.js:106:17)
jtg7
2017-04-05 15:39:23-07:00 at [object Object].<anonymous> (/app/bundle/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:156:15)
jtg7
2017-04-05 15:39:23-07:00 at [object Object].emit (events.js:98:17)
jtg7
2017-04-05 15:39:23-07:00 at Socket.<anonymous> (/app/bundle/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/connection/connection.js:534:10)
jtg7
2017-04-05 15:39:23-07:00 at Socket.emit (events.js:95:17)
jtg7
2017-04-05 15:39:23-07:00 at net.js:441:14
jtg7
2017-04-05 15:39:23-07:00 at process._tickDomainCallback (node.js:492:13)