mongodb : Increasing max connections in mongodb

前端 未结 5 1055
名媛妹妹
名媛妹妹 2020-12-03 21:52

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
schedu         


        
5条回答
  •  醉话见心
    2020-12-03 22:20

    Method 1 If you use systemd (systemctl restart mongod)

    sudo mkdir /etc/systemd/system/mongod.service.d/
    sudo vi /etc/systemd/system/mongod.service.d/limits.conf
    

    then add:

    [Service]
    LimitFSIZE=infinity
    LimitCPU=infinity
    LimitAS=infinity
    LimitMEMLOCK=infinity
    LimitNOFILE=64000
    LimitNPROC=64000
    

    Then execute:

    systemctl daemon-reload
    systemctl restart mongod
    

    Method 2 If NO systemd (service mongod restart)

    sudo vi /etc/security/limits.d/99-mongodb.conf
    

    Add something like:

    *       -       nproc   64000
    *       -       nofile  64000
    *       -       fsize   unlimited
    *       -       cpu     unlimited
    *       -       memlock unlimited
    *       -       as      unlimited
    *       -       rss     unlimited
    

    Note that * it's a wildcard. But you could use a specific user or group. Then restart session and mongod.

提交回复
热议问题