MongoDB Maximum Connection number optimization

Source: Internet
Author: User

Recently in the MONGO database cluster, used in the production environment after the discovery of the client will be denied access. The query process found that the route MONGOs is not down, can ping through, and then view the maximum number of connections, found to be full.

Popular Science: Under the Linux platform, either 64-bit or 32-bit MONGODB default maximum connection number is 819,win platform do not know, estimated also no one in the win platform using MONGODB production environment.

Therefore, the maximum number of connections is modified.

1. Query the maximum number of connections:

Db.serverstats (). connections

2. Modify the maximum number of connections:

Shut down the database, reboot plus parameters maxconns:mongodb--port 27017--dbpath data/--maxconn 300

3. Reboot to see the maximum number of connections:

Db.serverstats (). connections

The discovery is still 819, has not changed, this is what? After some research, it is found that this is the system limit, the Linux default process can open the maximum number of files is limited, can be resolved through ulimit.

4. Setting up the system

Linux switch to Super User, Ulimit-n 4000, can also be modified in the configuration file,/etc/rc.local add ulimit-n 4000

5. Restart MongoDB to see the maximum number of connections has become 3000


This article is from the "Black Time" blog, so be sure to keep this source http://blacktime.blog.51cto.com/11722918/1795308

MongoDB Maximum Connection number optimization

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.