MongoDB IntelliJ plugin failed with auth - mongodb

I'm trying to connect to my mongo instance wich I ran as mongod --auth after configuring
use admin
db.createUser(
{
user: "myUserAdmin",
pwd: "abc123",
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
}
)
The configuration on Mongo-IntelliJ plugin looks like this:
The result is that the connection is refused.
Here is (some of) the output of mongod:
2016-10-26T08:40:09.218+0300 I NETWORK [conn45] end connection 127.0.0.1:59014 (0 connections now open)
2016-10-26T08:40:09.718+0300 I NETWORK [initandlisten] connection accepted from 127.0.0.1:59015 #46 (1 connection now open)
2016-10-26T08:40:09.721+0300 I NETWORK [conn46] end connection 127.0.0.1:59015 (0 connections now open)
2016-10-26T08:40:10.221+0300 I NETWORK [initandlisten] connection accepted from 127.0.0.1:59016 #47 (1 connection now open)
2016-10-26T08:40:10.224+0300 I NETWORK [conn47] end connection 127.0.0.1:59016 (0 connections now open)
2016-10-26T08:40:10.725+0300 I NETWORK [initandlisten] connection accepted from 127.0.0.1:59017 #48 (1 connection now open)
2016-10-26T08:40:10.728+0300 I NETWORK [conn48] end connection 127.0.0.1:59017 (0 connections now open)
I tried various combinations with the auth mechanism, but with the same results.
Is there something wrong in my configuration or in the plugin?

Related

MongoDB log file shows connection accepted & end connection constantly

I'm trying to install MongoDb server in Redhat 7 GCE
After starting Mongod process with replication, the mongolog shows an error log..
`2017-12-29T20:51:12.853+0530 I NETWORK [initandlisten] connection accepted
from 10.142.0.2:38130 #53 (1 connection now open)
2017-12-29T20:51:42.861+0530 I NETWORK [conn53] end connection
10.142.0.2:38130 (0 connections now open)
2017-12-29T20:51:42.862+0530 I NETWORK [initandlisten] connection accepted
from 10.142.0.2:38136 #54 (1 connection now open)
2017-12-29T20:52:12.868+0530 I NETWORK [conn54] end connection
10.142.0.2:38136 (0 connections now open)
2017-12-29T20:52:12.869+0530 I NETWORK [initandlisten] connection accepted
from 10.142.0.2:38144 #55 (1 connection now open)
2017-12-29T20:52:42.877+0530 I NETWORK [conn55] end connection
10.142.0.2:38144 (0 connections now open)
2017-12-29T20:52:42.877+0530 I NETWORK [initandlisten] connection accepted
from 10.142.0.2:38150 #56 (1 connection now open)
2017-12-29T20:53:12.883+0530 I NETWORK [conn56] end connection
10.142.0.2:38150 (0 connections now open)
2017-12-29T20:53:12.883+0530 I NETWORK [initandlisten] connection accepted
from 10.142.0.2:38156 #57 (1 connection now open)
2017-12-29T20:53:42.891+0530 I NETWORK [conn57] end connection
10.142.0.2:38156 (0 connections now open)
2017-12-29T20:53:42.892+0530 I NETWORK [initandlisten] connection accepted
from 10.142.0.2:38162 #58 (1 connection now open)
2017-12-29T20:54:12.900+0530 I NETWORK [conn58] end connection
10.142.0.2:38162 (0 connections now open)
2017-12-29T20:54:12.900+0530 I NETWORK [initandlisten] connection accepted
from 10.142.0.2:38170 #59 (1 connection now open)
2017-12-29T20:54:42.908+0530 I NETWORK [conn59] end connection
10.142.0.2:38170 (0 connections now open)
2017-12-29T20:54:42.908+0530 I NETWORK [initandlisten] connection accepted
from 10.142.0.2:38174 #60 (1 connection now open)
2017-12-29T20:55:12.917+0530 I NETWORK [conn60] end connection
10.142.0.2:38174 (0 connections now open)
`
I can connect from the redhat shell as
mongo --port 34672
but when i try to connect from an external ip it fails.
i was not able to find the reason for this error after checking all the error logs and searching in the web.
These log entries to not indicate an error. It is simply reporting connections. As for the reason for the connections, there could be several:
If you have an application using MongoDB, these connections are likely coming from that application.
If you have monitoring such as Stackdriver Monitoring installed, these could be connections from the monitoring to fetch statistics from MongoDB.
If you are using a cluster of MongoDB servers, this could be connections or health-checking between them.
I think (2) or (3) are especially likely, given that they are coming from internal IP addresses are are spaced exactly 30 seconds apart.
I believe your issue connecting externally is unrelated to these messages. If that is what you are really concerned about, I suggest you open a new question about that.

stuck of start mongoDB

2017-03-01T00:51:32.863-0500 I CONTROL [initandlisten]
2017-03-01T00:51:33.271-0500 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory 'D:/mongo/data/diagnostic.data'
2017-03-01T00:51:33.284-0500 I NETWORK [thread1] waiting for connections on port 27017
2017-03-01T00:51:33.391-0500 I NETWORK [thread1] connection accepted from 127.0.0.1:50501 #1 (1 connection now open)
2017-03-01T00:51:33.394-0500 I NETWORK [thread1] connection accepted from 127.0.0.1:50502 #2 (2 connections now open)
2017-03-01T00:51:33.399-0500 I NETWORK [thread1] connection accepted from 127.0.0.1:50503 #3 (3 connections now open)
2017-03-01T00:51:33.401-0500 I NETWORK [thread1] connection accepted from 127.0.0.1:50504 #4 (4 connections now open)
2017-03-01T00:51:33.406-0500 I NETWORK [thread1] connection accepted from 127.0.0.1:50505 #5 (5 connections now open)
2017-03-01T00:51:33.418-0500 I NETWORK [thread1] connection accepted from 127.0.0.1:50506 #6 (6 connections now open)
When I start the mongoDB, the command line pop up these things, how could I fix it? I have tried delete the data folder...

Strange MongoError (with ReactiveMongo) when Play reloads application

Very often, when Play reloads the application after a code change, I receive the following error:
MongoError['The node set can not be reached! Please check your network
connectivity.']
The MongoDB log looks like this:
2016-09-06T18:51:22.609+0200 I NETWORK [initandlisten] waiting for connections on port 27017
2016-09-06T18:53:49.916+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:60559 #1 (1 connection now open)
2016-09-06T18:53:51.185+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:60561 #2 (2 connections now open)
2016-09-06T18:53:51.196+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:60562 #3 (3 connections now open)
2016-09-06T18:53:51.206+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:60563 #4 (4 connections now open)
2016-09-06T18:53:51.217+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:60564 #5 (5 connections now open)
2016-09-06T18:53:51.227+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:60565 #6 (6 connections now open)
2016-09-06T18:53:51.237+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:60566 #7 (7 connections now open)
2016-09-06T18:53:51.248+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:60567 #8 (8 connections now open)
2016-09-06T18:53:51.258+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:60568 #9 (9 connections now open)
2016-09-06T18:53:51.269+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:60569 #10 (10 connections now open)
2016-09-06T18:53:59.533+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:60577 #11 (11 connections now open)
2016-09-06T18:53:59.546+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:60578 #12 (12 connections now open)
2016-09-06T18:53:59.557+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:60579 #13 (13 connections now open)
2016-09-06T18:53:59.568+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:60580 #14 (14 connections now open)
2016-09-06T18:53:59.579+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:60581 #15 (15 connections now open)
2016-09-06T18:53:59.589+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:60582 #16 (16 connections now open)
2016-09-06T18:53:59.600+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:60583 #17 (17 connections now open)
2016-09-06T18:53:59.610+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:60584 #18 (18 connections now open)
2016-09-06T18:53:59.620+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:60585 #19 (19 connections now open)
2016-09-06T19:37:21.594+0200 I NETWORK [conn11] end connection 127.0.0.1:60577 (18 connections now open)
2016-09-06T19:37:21.596+0200 I NETWORK [conn1] end connection 127.0.0.1:60559 (17 connections now open)
2016-09-06T19:37:21.597+0200 I NETWORK [conn15] end connection 127.0.0.1:60581 (16 connections now open)
2016-09-06T19:37:21.597+0200 I NETWORK [conn13] end connection 127.0.0.1:60579 (15 connections now open)
2016-09-06T19:37:21.597+0200 I NETWORK [conn16] end connection 127.0.0.1:60582 (14 connections now open)
2016-09-06T19:37:21.598+0200 I NETWORK [conn12] end connection 127.0.0.1:60578 (13 connections now open)
2016-09-06T19:37:21.598+0200 I NETWORK [conn19] end connection 127.0.0.1:60585 (13 connections now open)
2016-09-06T19:37:21.599+0200 I NETWORK [conn17] end connection 127.0.0.1:60583 (11 connections now open)
2016-09-06T19:37:21.599+0200 I NETWORK [conn14] end connection 127.0.0.1:60580 (11 connections now open)
2016-09-06T19:37:21.600+0200 I NETWORK [conn18] end connection 127.0.0.1:60584 (9 connections now open)
2016-09-06T19:37:21.607+0200 I NETWORK [conn5] end connection 127.0.0.1:60564 (9 connections now open)
2016-09-06T19:37:21.607+0200 I NETWORK [conn9] end connection 127.0.0.1:60568 (9 connections now open)
2016-09-06T19:37:21.608+0200 I NETWORK [conn6] end connection 127.0.0.1:60565 (9 connections now open)
2016-09-06T19:37:21.608+0200 I NETWORK [conn10] end connection 127.0.0.1:60569 (9 connections now open)
2016-09-06T19:37:21.609+0200 I NETWORK [conn2] end connection 127.0.0.1:60561 (9 connections now open)
2016-09-06T19:37:21.609+0200 I NETWORK [conn7] end connection 127.0.0.1:60566 (9 connections now open)
2016-09-06T19:37:21.610+0200 I NETWORK [conn3] end connection 127.0.0.1:60562 (9 connections now open)
2016-09-06T19:37:21.611+0200 I NETWORK [conn4] end connection 127.0.0.1:60563 (4 connections now open)
2016-09-06T19:37:21.612+0200 I NETWORK [conn8] end connection 127.0.0.1:60567 (0 connections now open)
2016-09-06T19:37:22.326+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:62077 #20 (1 connection now open)
2016-09-06T19:37:22.333+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:62078 #21 (2 connections now open)
2016-09-06T19:37:22.333+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:62079 #22 (3 connections now open)
2016-09-06T19:37:22.343+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:62080 #23 (4 connections now open)
2016-09-06T19:37:22.344+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:62081 #24 (5 connections now open)
2016-09-06T19:37:22.344+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:62082 #25 (6 connections now open)
2016-09-06T19:37:22.344+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:62083 #26 (7 connections now open)
2016-09-06T19:37:22.344+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:62084 #27 (8 connections now open)
2016-09-06T19:37:22.354+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:62085 #28 (9 connections now open)
2016-09-06T19:37:22.355+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:62086 #29 (10 connections now open)
2016-09-06T19:37:32.348+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:62105 #30 (11 connections now open)
2016-09-06T19:37:32.359+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:62106 #31 (12 connections now open)
2016-09-06T19:37:32.393+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:62107 #32 (13 connections now open)
2016-09-06T19:37:32.399+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:62108 #33 (14 connections now open)
2016-09-06T19:37:32.399+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:62109 #34 (15 connections now open)
2016-09-06T19:37:32.399+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:62110 #35 (16 connections now open)
2016-09-06T19:37:32.399+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:62111 #36 (17 connections now open)
2016-09-06T19:37:32.401+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:62112 #37 (18 connections now open)
2016-09-06T19:37:32.401+0200 I NETWORK [initandlisten] connection accepted from 127.0.0.1:62113 #38 (19 connections now open)
Sometimes there's also this exception:
[warn] r.c.a.MongoDBSystem - The entire node set is unreachable, is there a network problem?
[warn] r.c.a.MongoDBSystem - The entire node set is unreachable, is there a network problem?
[error] r.api.Failover2 - Got an error, no more attempts to do. Completing with a failure...
reactivemongo.core.actors.Exceptions$PrimaryUnavailableException$: MongoError['No primary node is available!']
at reactivemongo.core.actors.Exceptions$PrimaryUnavailableException$.<clinit>(actors.scala)
at reactivemongo.core.actors.MongoDBSystem$$anonfun$reactivemongo$core$actors$MongoDBSystem$$pickChannel$4.apply(actors.scala:748)
at reactivemongo.core.actors.MongoDBSystem$$anonfun$reactivemongo$core$actors$MongoDBSystem$$pickChannel$4.apply(actors.scala:748)
at scala.Option.getOrElse(Option.scala:121)
at reactivemongo.core.actors.MongoDBSystem$class.reactivemongo$core$actors$MongoDBSystem$$pickChannel(actors.scala:748)
at reactivemongo.core.actors.MongoDBSystem$$anonfun$4.applyOrElse(actors.scala:340)
at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:170)
at akka.actor.Actor$class.aroundReceive(Actor.scala:482)
at reactivemongo.core.actors.LegacyDBSystem.aroundReceive(actors.scala:896)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526)
[error] r.api.Failover2 - Got an error, no more attempts to do. Completing with a failure...
reactivemongo.core.actors.Exceptions$PrimaryUnavailableException$: MongoError['No primary node is available!']
at reactivemongo.core.actors.Exceptions$PrimaryUnavailableException$.<clinit>(actors.scala)
at reactivemongo.core.actors.MongoDBSystem$$anonfun$reactivemongo$core$actors$MongoDBSystem$$pickChannel$4.apply(actors.scala:748)
at reactivemongo.core.actors.MongoDBSystem$$anonfun$reactivemongo$core$actors$MongoDBSystem$$pickChannel$4.apply(actors.scala:748)
at scala.Option.getOrElse(Option.scala:121)
at reactivemongo.core.actors.MongoDBSystem$class.reactivemongo$core$actors$MongoDBSystem$$pickChannel(actors.scala:748)
at reactivemongo.core.actors.MongoDBSystem$$anonfun$4.applyOrElse(actors.scala:340)
at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:170)
at akka.actor.Actor$class.aroundReceive(Actor.scala:482)
at reactivemongo.core.actors.LegacyDBSystem.aroundReceive(actors.scala:896)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526)
[error] r.api.Failover2 - Got an error, no more attempts to do. Completing with a failure...
reactivemongo.core.actors.Exceptions$PrimaryUnavailableException$: MongoError['No primary node is available!']
at reactivemongo.core.actors.Exceptions$PrimaryUnavailableException$.<clinit>(actors.scala)
at reactivemongo.core.actors.MongoDBSystem$$anonfun$reactivemongo$core$actors$MongoDBSystem$$pickChannel$4.apply(actors.scala:748)
at reactivemongo.core.actors.MongoDBSystem$$anonfun$reactivemongo$core$actors$MongoDBSystem$$pickChannel$4.apply(actors.scala:748)
at scala.Option.getOrElse(Option.scala:121)
at reactivemongo.core.actors.MongoDBSystem$class.reactivemongo$core$actors$MongoDBSystem$$pickChannel(actors.scala:748)
at reactivemongo.core.actors.MongoDBSystem$$anonfun$4.applyOrElse(actors.scala:340)
at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:170)
at akka.actor.Actor$class.aroundReceive(Actor.scala:482)
at reactivemongo.core.actors.LegacyDBSystem.aroundReceive(actors.scala:896)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526)
When I completely kill the process and execute activator run again, everything works like before.
Here's how I use ReactiveMongo:
val collection: Future[JSONCollection] = reactiveMongoApi.database.map(_.collection[JSONCollection](collectionName))
Used versions:
MongoDB: v3.2.4
Scala: 2.11.8
Play 2.5
play2-reactivemongo: 0.11.13
reactivemongo-play-json: 0.11.14
As developing like this takes forever, I would appreciate any help to fix this issue! :-)
I faced this issue as well; every time I reloaded my Play application (including hot reloads), I received hundreds of connection errors. After trying a couple times, my application would run fine until the next reload. This only started happening after I upgraded from ReactiveMongo 0.x to 1.x. I've tried running MongoDB (versions 3.2 through 4.0) locally, as both a native install and in a Docker container.
I "solved" it by adding the following connection options:
MongoConnectionOptions(maxIdleTimeMS = 100000, heartbeatFrequencyMS = 100)
The full connection looks like this:
private val driver = new reactivemongo.api.AsyncDriver
val connection: Future[MongoConnection] = driver.connect(List("localhost"), MongoConnectionOptions(maxIdleTimeMS = 100000, heartbeatFrequencyMS = 100))
I don't know why these values seem to work, or whether they're optimal. And I probably wouldn't recommend running a heartbeat of 100ms in production. However, it's working for my development needs, so I figured I'd share.

Reactivemongo leaking connections during Play hot-reload

I have a Scala-based Play app that uses ReactiveMongo. When in development mode and a hot-reload occurs, ReactiveMongo leaks connections. For example, here is a snippet of Mongo's log files; I added a line break in the logs to indicate each time a hot-reload occurred (i.e. I made a trivial change the app and reloaded a page in the browser)
2015-09-26T09:43:43.353-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58612 #1 (1 connection now open)
2015-09-26T09:43:43.725-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58613 #2 (2 connections now open)
2015-09-26T09:43:43.725-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58614 #3 (3 connections now open)
2015-09-26T09:43:43.725-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58615 #4 (4 connections now open)
2015-09-26T09:43:43.725-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58616 #5 (5 connections now open)
2015-09-26T09:43:43.726-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58617 #6 (6 connections now open)
2015-09-26T09:43:43.726-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58618 #7 (7 connections now open)
2015-09-26T09:43:43.726-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58619 #8 (8 connections now open)
2015-09-26T09:43:43.726-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58620 #9 (9 connections now open)
2015-09-26T09:43:43.726-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58621 #10 (10 connections now open)
2015-09-26T09:43:43.810-0700 I INDEX [conn1] build index on: sma.destination properties: { v: 1, unique: true, key: { id: 1 }, name: "idx_destination_id", ns: "sma.destination" }
2015-09-26T09:43:43.810-0700 I INDEX [conn1] building index using bulk method
2015-09-26T09:43:57.164-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58640 #11 (11 connections now open)
2015-09-26T09:43:57.169-0700 I NETWORK [conn11] end connection 127.0.0.1:58640 (10 connections now open)
2015-09-26T09:43:57.431-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58641 #12 (11 connections now open)
2015-09-26T09:43:57.435-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58642 #13 (12 connections now open)
2015-09-26T09:43:57.436-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58643 #14 (13 connections now open)
2015-09-26T09:43:57.436-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58644 #15 (14 connections now open)
2015-09-26T09:43:57.437-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58645 #16 (15 connections now open)
2015-09-26T09:43:57.437-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58646 #17 (16 connections now open)
2015-09-26T09:43:57.437-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58647 #18 (17 connections now open)
2015-09-26T09:43:57.437-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58648 #19 (18 connections now open)
2015-09-26T09:43:57.437-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58649 #20 (19 connections now open)
2015-09-26T09:43:57.437-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58650 #21 (20 connections now open)
2015-09-26T09:43:57.487-0700 I INDEX [conn14] build index on: sma.destination properties: { v: 1, unique: true, key: { id: 1 }, name: "idx_destination_id", ns: "sma.destination" }
2015-09-26T09:43:57.487-0700 I INDEX [conn14] building index using bulk method
2015-09-26T09:44:16.559-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58677 #22 (21 connections now open)
2015-09-26T09:44:16.560-0700 I NETWORK [conn22] end connection 127.0.0.1:58677 (20 connections now open)
2015-09-26T09:44:16.766-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58678 #23 (21 connections now open)
2015-09-26T09:44:16.770-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58679 #24 (22 connections now open)
2015-09-26T09:44:16.771-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58680 #25 (23 connections now open)
2015-09-26T09:44:16.771-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58681 #26 (24 connections now open)
2015-09-26T09:44:16.771-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58682 #27 (25 connections now open)
2015-09-26T09:44:16.772-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58683 #28 (26 connections now open)
2015-09-26T09:44:16.772-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58684 #29 (27 connections now open)
2015-09-26T09:44:16.772-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58685 #30 (28 connections now open)
2015-09-26T09:44:16.772-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58686 #31 (29 connections now open)
2015-09-26T09:44:16.772-0700 I NETWORK [initandlisten] connection accepted from 127.0.0.1:58687 #32 (30 connections now open)
2015-09-26T09:44:16.791-0700 I INDEX [conn24] build index on: sma.destination properties: { v: 1, unique: true, key: { id: 1 }, name: "idx_destination_id", ns: "sma.destination" }
2015-09-26T09:44:16.792-0700 I INDEX [conn24] building index using bulk method
You can see that ReactiveMongo creates a pool of 10 connections each time a hot-reload occurs; the previous 10 connections don't get cleaned up. Eventually it gets to the max number of connections (currently ~ 200), and then mongo becomes inaccessible until I restart.
Presumably this wouldn't happen in prod, but I'm a little unnerved by it happening in dev in the first place. Is there any way I can close those connections when the app hot-reloads?
Had the same problem following slightly outdated tutorials (using Play 2.6)
From the docs:
http://reactivemongo.org/releases/0.12/documentation/tutorial/play.html
/*
* Get a JSONCollection (a Collection implementation that is designed to work
* with JsObject, Reads and Writes.)
* Note that the `collection` is not a `val`, but a `def`. We do _not_ store
* the collection reference to avoid potential problems in development with
* Play hot-reloading.
*/
def collection: Future[JSONCollection] = database.map(
_.collection[JSONCollection]("persons"))
In my case, replacing: val collection: JSonCollection to the format above solved my problem.
Now when reloading, it closes and reopens all the connections:
2017-08-15T15:32:50.991-0300 I - [conn2] end connection 127.0.0.1:58489 (10 connections now open)
2017-08-15T15:32:50.992-0300 I - [conn9] end connection 127.0.0.1:58496 (9 connections now open)
2017-08-15T15:32:50.992-0300 I - [conn4] end connection 127.0.0.1:58491 (8 connections now open)
2017-08-15T15:32:50.993-0300 I - [conn5] end connection 127.0.0.1:58492 (7 connections now open)
2017-08-15T15:32:50.994-0300 I - [conn6] end connection 127.0.0.1:58493 (6 connections now open)
and so on...

mongo: getting lots of connections when no backend is talking to db

I just created a mongo replicated setup with two instances. The logs show a lot of connections starting and ending every second. The logs are below. Any idea why there are so many connections when I don't have any servers talking to the DB? I'm also confused why the port the connections are coming from keep increasing.
Primary Mongo Instance
$ tail /log/mongod.log
2015-02-08T21:46:40.679+0000 [initandlisten] connection accepted from <local machine private IP from EC2>:43833 #58 (6 connections now open)
2015-02-08T21:46:40.680+0000 [conn58] authenticate db: local { authenticate: 1, nonce: "xxx", user: "__system", key: "xxx" }
2015-02-08T21:47:05.416+0000 [conn10] end connection <local machine private IP from EC2>:43719 (5 connections now open)
2015-02-08T21:47:05.416+0000 [conn13] end connection <local machine private IP from EC2>:43724 (4 connections now open)
2015-02-08T21:47:10.699+0000 [conn58] end connection <local machine private IP from EC2>:43833 (3 connections now open)
2015-02-08T21:47:10.700+0000 [initandlisten] connection accepted from <local machine private IP from EC2>:43835 #59 (4 connections now open)
2015-02-08T21:47:10.702+0000 [conn59] authenticate db: local { authenticate: 1, nonce: "xxx", user: "__system", key: "xxx" }
2015-02-08T21:47:40.720+0000 [conn59] end connection <local machine private IP from EC2>:43835 (3 connections now open)
2015-02-08T21:47:40.723+0000 [initandlisten] connection accepted from <local machine private IP from EC2>:43836 #60 (4 connections now open)
2015-02-08T21:47:40.724+0000 [conn60] authenticate db: local { authenticate: 1, nonce: "xxx", user: "__system", key: "xxx" }
Secondary Mongo Instance
$ tail /log/mongod.log
2015-02-08T21:46:39.732+0000 [conn285] authenticate db: local { authenticate: 1, nonce: "xxx", user: "__system", key: "xxx" }
2015-02-08T21:46:59.877+0000 [initandlisten] connection accepted from <local machine elastic IP from EC2>:42568 #286 (4 connections now open)
2015-02-08T21:46:59.881+0000 [conn286] end connection <local machine elastic IP from EC2>:42568 (3 connections now open)
2015-02-08T21:47:05.424+0000 [conn191] end connection <local machine private IP from EC2>:44756 (2 connections now open)
2015-02-08T21:47:09.750+0000 [conn285] end connection <local machine private IP from EC2>:43873 (1 connection now open)
2015-02-08T21:47:09.752+0000 [initandlisten] connection accepted from <local machine private IP from EC2>:43874 #287 (2 connections now open)
2015-02-08T21:47:09.753+0000 [conn287] authenticate db: local { authenticate: 1, nonce: "xxx", user: "__system", key: "xxx" }
2015-02-08T21:47:39.772+0000 [conn287] end connection <local machine private IP from EC2>:43874 (1 connection now open)
2015-02-08T21:47:39.774+0000 [initandlisten] connection accepted from <local machine private IP from EC2>:43875 #288 (2 connections now open)
2015-02-08T21:47:39.775+0000 [conn288] authenticate db: local { authenticate: 1, nonce: "xxx", user: "__system", key: "xxx" }
I am also a bit confused why the elastic IP is being used in some cases (see secondary log). I assume using the public IP would cause me to get charged by AWS?
The connections that are coming every 30 seconds are the heartbeat threads, coming from the other replica set member to make sure this member is still alive and healthy. They use whatever IP is in your replica set configuration.
The connection using the public IP seems to end its connection very quickly. Turn up your log level and figure out what it's doing?