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 

Now this is the result of my MongoDB

 db.serverStatus().connections { "current" : 4, "available" : 5996 } 

I want to increase MongoDb connections more by 10000.

I tried different options, for example in my mongod1.conf

 fork = true port = 27017 maxConns = 10000 

as well as when starting mongodb

 mongod ulimit -n 10000 --config mongod1.conf 

but nothing worked and everything failed, please let me know how I can increase the number of connections to 10,000 in my case, thanks in advance.

+6
source share
3 answers

You also need to increase the number of file descriptors and the number of file descriptors per process, which allows the Linux kernel.

On Linux, you need to configure this by editing the file in /proc/sys/fs/file-max or using the sysctl utility.

  • Edit the file /etc/sysctl.conf 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 a limit on the total maximum number of file descriptors.

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

+4
source

You may need to change the hard limits in /etc/limits.conf or /etc/limits.conf depending on your distribution.

+1
source

You tried:

 --maxConns arg max number of simultaneous connections 

(Source: mongod documentation)

+1
source

Source: https://habr.com/ru/post/945677/


All Articles