Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase Neo4j's maximum file open limit (ulimit) in Ubuntu?

Currently ulimit -n shows 10000. I want to increase it to 40000. I've edited "/etc/sysctl.conf" and put fs.file-max=40000. I've also edited /etc/security/limits.conf and updated hard and soft values. But still ulimit shows 10000. After making all these changes I rebooted my laptop. I've access to root password.

usr_name@usr_name-lap:/etc$ /sbin/sysctl fs.file-max fs.file-max = 500000 

Added following lines in /etc/security/limits.conf -

*     soft    nofile          40000 *     hard    nofile          40000 

I also added following line in /etc/pam.d/su-

session    required   pam_limits.so 

I've tried every possible way as given on other forums, but I can reach up to a maximum limit of 10000, not beyond that. What can be the issue?

I'm making this change because neo4j throws maximum open file limits reached error.

like image 938
theharshest Avatar asked Feb 02 '14 19:02

theharshest


People also ask

How to increase open file limit in Ubuntu?

First of all, open your Ubuntu terminal by pressing “CTRL+ALT+T”. Now, we will check out the current limits of the resources. For this, we will execute the “unlimit” command.

What is maximum limit for open files in Linux?

Linux systems limit the number of file descriptors that any one process may open to 1024 per process. (This condition is not a problem on Solaris machines, x86, x64, or SPARC). After the directory server has exceeded the file descriptor limit of 1024 per process, any new process and worker threads will be blocked.


1 Answers

What you are doing will not work for root user. Maybe you are running your services as root and hence you don't get to see the change.

To increase the ulimit for root user you should replace the * by root. * does not apply for root user. Rest is the same as you did. I will re-quote it here.

Add the following lines to the file: /etc/security/limits.conf

root soft  nofile 40000  root hard  nofile 40000 

And then add following line in the file: /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.

like image 63
Sambhav Sharma Avatar answered Oct 18 '22 18:10

Sambhav Sharma