Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

mongodb : Increasing max connections in mongodb

i need your help in solving this

this is the result of my ulimit -a on my linux server

   core file size          (blocks, -c) 0
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 10000
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 24576
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

Right now this is the result of my MongoDB

db.serverStatus().connections

{ "current" : 4, "available" : 5996 }

I want to increase the MongoDb connections more to 10000 .

I have tried different options like in my mongod1.conf

fork    = true
port    = 27017
maxConns = 10000

and also this while starting mongodb

mongod ulimit -n 10000  --config mongod1.conf 

but nothing worked and all failed , please let me know how can i increase the connections to 10000 in my case , thanks in advance .

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You also need bump up the number of file descriptors and number of file descriptors per process that the Linux kernel allows.

In Linux, this should be configured by editing the file at /proc/sys/fs/file-max or by the sysctl utility.

  • Edit the /etc/sysctl.conf file and add fs.file-max = 50000. This sets the maximum file descriptors that can run as a system-wide limit.
  • Running ulimit -n 50000 sets the user-wide limit for the maximum number of file descriptors open.

Check this link for a more descriptive write-up for editing the limits on a linux machine: http://www.cyberciti.biz/faq/linux-increase-the-maximum-number-of-open-files/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...