A . MongoDB Connection Number
Under the Linux platform, either 64-bit or 32-bit MONGODB default maximum connection number is 819,win platform do not know, estimated that no one in the win platform using MONGODB production environment
[Email protected] mongodb-3.0.4]#./bin/mongo
MongoDB Shell version:3.0.4
Connecting To:test
> Use admin
Switched to DB admin
> Db.auth (' User ', ' password ');
1
> Db.serverstatus (). connections;
{"Current": 1, "available": 818, "totalcreated": Numberlong (2)}
The above available shows that 818 is missing one, which means it is free. Current represents the number of connections already occupied, two number one plus equals 819, if I'm connecting now, then available is 817,current is 2.
[Email protected] mongodb-3.0.4]#./bin/mongo
MongoDB Shell version:3.0.4
Connecting To:test
> Exit
Bye
[Email protected] mongodb-3.0.4]#/bin/mongo 192.168.5.215
MongoDB Shell version:3.0.4
Connecting To:192.168.5.215/test
> Use admin
Switched to DB admin
> Db.auth (' al_user ', ' 123456 ');
1
> Db.serverstatus (). connections;
{"Current": 2, "available": 817, "totalcreated": Numberlong (3)}
819 connections for the general site I think it is enough, and are now connected to the current withdrawal. However, the number of connections can also be modified, as long as the boot time to add--maxconns can
Two. Modify the number of MONGODB connections
[Email protected] mongodb-3.0.4]#/bin/mongod--maxconns=41942
MongoDB Shell version:3.0.4
Connecting To:test
View MONGO logs
[[email protected] mongodb-3.0.4]# vim./log/mongo.log
2016-04-22t12:02:43.669+0800 I CONTROL [Initandlisten] Options: {net: {maxincomingconnections:41942},
> Db.serverstatus (). connections;
{"Current": 1, "available": 818, "totalcreated": Numberlong (2)}
Find it or 819? In fact, the Linux default process can open the maximum number of files, can be resolved by ulimit
[Email protected] mongodb-3.0.4]# ulimit-n 41942
Learn more about Ulimit you can go online search and search
To see the maximum number of connections again
[Email protected] mongodb-3.0.4]#/bin/mongod--maxconns=41942
> Use admin
Switched to DB admin
> Db.auth (' User ', ' password ');
1
> Db.serverstatus (). connections;
{"Current": 1, "available": 41941, "totalcreated": Numberlong (1)}
Get!
View and modify the maximum number of MONGODB connections