问题描述
我需要您的帮助来解决此问题
i need your help in solving this
这是我的ulimit -a
在我的linux服务器上的结果
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
现在这是我的MongoDB的结果
Right now this is the result of my MongoDB
db.serverStatus().connections
{ "current" : 4, "available" : 5996 }
我想将MongoDb连接更多地增加到10000个.
I want to increase the MongoDb connections more to 10000 .
我尝试了不同的选项,例如在mongod1.conf中
I have tried different options like in my mongod1.conf
fork = true
port = 27017
maxConns = 10000
以及启动mongodb时的这一点
and also this while starting mongodb
mongod ulimit -n 10000 --config mongod1.conf
但是没有任何效果并且全部失败,请提前告知我如何将连接增加到10000个.
but nothing worked and all failed , please let me know how can i increase the connections to 10000 in my case , thanks in advance .
推荐答案
您还需要提高Linux内核允许的文件描述符数量和每个进程的文件描述符数量.
You also need bump up the number of file descriptors and number of file descriptors per process that the Linux kernel allows.
在Linux中,应通过在/proc/sys/fs/file-max
或sysctl
实用程序中编辑文件来进行配置.
In Linux, this should be configured by editing the file at /proc/sys/fs/file-max
or by the sysctl
utility.
- 编辑
/etc/sysctl.conf
文件并添加fs.file-max = 50000
.这将设置可以作为系统范围限制运行的最大文件描述符. - 运行
ulimit -n 50000
为打开的文件描述符的最大数量设置用户范围的限制.
- Edit the
/etc/sysctl.conf
file and addfs.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.
检查此链接以获取更具描述性的文章,以编辑Linux机器上的限制: http://www.cyberciti.biz/faq/linux-increase-the-maximum-number-of-open-files/
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/
这篇关于mongodb:增加mongodb中的最大连接数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!