@awatson1978 I’m so near to resolve it :
-
The huge data amount came from CollectionFS. I don’t know why but after a while it stopped from loading stuff. To be sure that there is nothing more I removed it from my project.
-
About “No primary found in set”.
I stopped every thing my app and my replicaSet.
I started my replicaSet and then my app with 20 workers on EC2 -> that was surprisingly OK.
Then I stopped my app and started with 25 workers on EC2 -> that didn’t work.
And I stopped it again and started with 1 workers on EC2 -> that didn’t work either.
But this time I could see “Error: connection closed”.
So I stopped every thing again.
I started my replicaSet and run serverStatus
sudo mongod --fork --syslog --port 27017 --dbpath /data/db/27017 --replSet testingRplSet --keyFile keyFile
sudo mongod --fork --syslog --port 27018 --dbpath /data/db/27018 --replSet testingRplSet --keyFile keyFile
sudo mongod --fork --syslog --port 27019 --dbpath /data/db/27019 --replSet testingRplSet --keyFile keyFile
testingRplSet:PRIMARY> db.serverStatus().connections
{ “current” : 409, “available” : 410, “totalCreated” : NumberLong(486) }
Where do the 409 connections come from ? It should be 3, my mongo shell and the replicaset
I started my app on EC2 with 25 workers:
testingRplSet:PRIMARY> db.serverStatus().connections
{ “current” : 773, “available” : 46, “totalCreated” : NumberLong(1444) }
It should be 26 connexion more than before but here are 364 new connections…
If I now stop my app and run it again there are 0 available connections left and I get this “Error: connection closed” . Why are the connection still there ? I have no clue yet.
I stopped everything again.
Lunched my replicaSet with bind_ip.
sudo mongod --fork --syslog --port 27017 --dbpath /data/db/27017 --replSet testingRplSet --keyFile keyFile --bind_ip 127.0.0.1
sudo mongod --fork --syslog --port 27018 --dbpath /data/db/27018 --replSet testingRplSet --keyFile keyFile --bind_ip 127.0.0.1
sudo mongod --fork --syslog --port 27019 --dbpath /data/db/27019 --replSet testingRplSet --keyFile keyFile --bind_ip 127.0.0.1
serverStatus gives this :
testingRplSet:PRIMARY> db.serverStatus().connections
{ “current” : 253, “available” : 566, “totalCreated” : NumberLong(400) }
I started my app on localhost with 4 workers :
testingRplSet:PRIMARY> db.serverStatus().connections
{ “current” : 288, “available” : 531, “totalCreated” : NumberLong(2141)}
I conclude that something somewhere takes my connections away and doesn’t give it back 
Solution :
I didn’t find why I had so much connections at start but you can change the connection limit.
I transfered my data to compose.io and everything was fine now.