Problem
Currently, ulimit -n returns a value of 10000. I’d like to raise it to 40000. fs.file-max=40000 has been added to “/etc/sysctl.conf.” I also modified the hard and soft values in /etc/security/limits.conf. However, ulimit still shows 10000. I rebooted my laptop after making all of these modifications. I have the root password.
usr_name@usr_name-lap:/etc$ /sbin/sysctl fs.file-max
fs.file-max = 500000
In /etc/security/limits.conf, I added the following lines:
* soft nofile 40000
* hard nofile 40000
In /etc/pam.d/su-su-su-su-su-su-su-su-su-su-su-
session required pam_limits.so
I’ve tried every method suggested on other forums, but I can only get up to a maximum of 10,000 points. What could be the problem?
Because neo4j throws the maximum open file limits reached error, I’m making this adjustment.
Asked by theharshest
Solution #1
What you’re doing isn’t going to work for the root user. You might not notice the change because you’re running your services as root.
Replace * with root to increase the ulimit for root user. * does not apply to root user. The rest is the same as before. I’ll paraphrase it here.
To the file, add the following lines: /etc/security/limits.conf
root soft nofile 40000
root hard nofile 40000
Then, in the file, add the following line: /etc/pam.d/common-session
session required pam_limits.so
This will update the ulimit for root user. As mentioned in comments, you may don’t even have to reboot to see the change.
Answered by Sambhav Sharma
Solution #2
1) Check the file-max-limit sysctl:
$ cat /proc/sys/fs/file-max
If the limit is lower than your desired value, open the sysctl.conf and add this line at the end of file:
fs.file-max = 65536
Finally, apply sysctl limits:
$ sysctl -p
2) Open /etc/security/limits.conf and add the lines below.
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
These restrictions do not apply to root users; if you want to change root restrictions, you must do so explicitly:
root soft nofile 65535
root hard nofile 65535
...
3) Restart the system or add the following line to /etc/pam.d/common-session:
session required pam_limits.so
Log out and then log back in.
4) Check soft limits:
$ ulimit -a
and hard limits:
$ ulimit -Ha
....
open files (-n) 65535
Reference : http://ithubinfo.blogspot.in/2013/07/how-to-increase-ulimit-open-file-and.html
Answered by minhas23
Solution #3
I am using Debian but this solution should work fine with Ubuntu. You have to add a line in the neo4j-service script. Here is what I have done :
Note that I am using version 2.0 Enterprise edition. Hope this will help you.
Answered by Martin Larivière
Solution #4
I had the same problem and was able to solve it by adding entries to the /etc/security/limits.d/90-somefile.conf file. It’s worth noting that in order to see the restrictions in action, I had to exit out of the ssh session completely and then enter back in.
I wanted to create a limit for a certain user who runs a service, but it appears that I’m getting the limit for the user I’m logged in as. Here’s an example of how the ulimit is determined by the authorized user rather than the effective user:
$ sudo cat /etc/security/limits.d/90-nofiles.conf
loginuser soft nofile 10240
loginuser hard nofile 10240
root soft nofile 10241
root hard nofile 10241
serviceuser soft nofile 10242
serviceuser hard nofile 10242
$ whoami
loginuser
$ ulimit -n
10240
$ sudo -i
# ulimit -n
10240 # loginuser's limit
# su - serviceuser
$ ulimit -n
10240 # still loginuser's limit.
You can specify an increase for all users by using a *. I can see that the initial login user’s limitations are in place if I restart the service as the user I logged in as and add ulimit -n to the init script. I haven’t had an opportunity to check which user’s limitations are used during a system boot, or to figure out what the service’s actual nofile limit is (which is started with start-stop-daemon).
There are two ways that are currently working:
Answered by Brett
Solution #5
You might add an ulimit -n 40000 to the neo4j init script before running it.
However, I’m afraid I think you’re barking up the wrong tree. Is it true that neo4j requires more than 10,000 open file descriptors? This sounds like a neo4j bug or a problem with the way you’re using it. That is something I would strive to address.
Answered by abligh
Post is based on https://stackoverflow.com/questions/21515463/how-to-increase-neo4js-maximum-file-open-limit-ulimit-in-ubuntu