View and modify the maximum number of MONGODB connections

Source: Internet
Author: User
Tags auth mongodb

 

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.