How to increase the maximum open file limit of Neo4j (ulimit) in Ubuntu?

Currently ulimit -n displays 10000 . I want to increase it to 40000 . I edited /etc/sysctl.conf and put fs.file-max=40000 . I also edited /etc/security/limits.conf and updated the hard and soft values. But still ulimit shows 10000 . Having made all these changes, I rebooted my laptop. I have access to the root password.

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

Added the following lines to /etc/security/limits.conf -

 * soft nofile 40000 * hard nofile 40000 

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

 session   required  pam_limits.so 

I tried all possible ways, as it was given in other forums, but I can reach the maximum limit of 10000 , and not beyond this. What could be the problem?

I am making this change because neo4j gives the maximum permissible open file limits.

+74
linux neo4j ubuntu limit ulimit
Feb 02 '14 at 19:58
source share
10 answers

I am using Debian, but this solution should work fine with Ubuntu.
You must add a line to the neo4j-service script.
Here is what I did:

nano / etc / init.d / neo4j-service
Add " ulimit -n 40000 " before the start-stop-daemon line in the do_start section

Please note that I am using version 2.0 of the Enterprise Edition. Hope this helps you.

+7
Feb 03 '14 at 19:31
source share

What you do will not work for the root user. Perhaps you are using your services as root, and therefore you are not seeing the change.

To increase ulimit for the root user, you must replace * with root. * not applicable for root user. Rest is the same as you. I will rewrite it here.

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

 root soft nofile 40000 root hard nofile 40000 

Then add the following line to the file: /etc/pam.d/common-session

 session required pam_limits.so 

This will update ulimit for the root user. As mentioned in the comments, you donโ€™t even need to reboot to see the changes.

+81
Jun 21 '14 at 8:32
source share

1) Check the sysctl file-max restriction:

 $ cat /proc/sys/fs/file-max 

If the limit is below the desired value, open sysctl.conf and add this line to the end of the file:

 fs.file-max = 65536 

Finally, apply the sysctl limits:

 $ sysctl -p 

2) Modify /etc/security/limits.conf and add the below mentioned

 * soft nproc 65535 * hard nproc 65535 * soft nofile 65535 * hard nofile 65535 

These restrictions will not apply to the root if you want to change the root restrictions that you must do this explicitly:

 root soft nofile 65535 root hard nofile 65535 ... 

3) Reboot the system or add the following line at the end of /etc/pam.d/common-session :

 session required pam_limits.so 

Log out and log in again.

4) Check soft limits:

 $ ulimit -a 

and hard limits:

 $ ulimit -Ha .... open files (-n) 65535 

Link: http://ithubinfo.blogspot.in/2013/07/how-to-increase-ulimit-open-file-and.html

+62
Jul 17 '14 at 6:37
source share

I had the same problem and got it by adding entries to /etc/security/limits.d/90-somefile.conf . Please note that in order to see the limits of work, I had to completely log out of the ssh session and then log in again.

I wanted to set a restriction for the specific user who starts the service, but it seems that I am getting a restriction set for the user I was a member of. Here is an example showing how ulimit is installed based on an authenticated user, not an 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 limit # su - serviceuser $ ulimit -n 10240 # still loginuser limit. 

You can use * to indicate an increase for all users. If I restart the service as the user who is logged in and add ulimit -n to the init script, I see that the user login user limits are in place. I did not have the opportunity to check what user limits are used at boot time, or to determine what the actual nofile limit is for the service that I am starting (which is started using the start-stop-daemon).

There are two approaches that work now:

  • add the ulimit setting to the init script, just before start-stop.
  • or more extensive ulimit settings in the security file.
+3
Oct 03 '14 at 9:03
source share

You can change the init script for neo4j to execute ulimit -n 40000 before starting neo4j .

However, I cannot help but feel that you are barking the wrong tree. Is neo4j over 10,000 open file descriptors? This is very similar to a bug in neo4j or the way you use it. I would try to solve this problem.

+2
Feb 02 '14 at 23:31
source share

I have a lot of problems getting this to work.

Using the following, you can update it regardless of your permission.

sudo sysctl -w fs.inotify.max_user_watches=100000

Edit

I just saw this from another user on another stackexchange site (both work, but this version constantly updates the system settings, and not temporarily):

 echo fs.inotify.max_user_watches=100000 | sudo tee -a /etc/sysctl.conf; sudo sysctl -p 
+2
Jul 10 '15 at 15:41
source share

Try running this command, it will create the *_limits.conf file in *_limits.conf

 echo "* soft nofile 102400" > /etc/security/limits.d/*_limits.conf && echo "* hard nofile 102400" >> /etc/security/limits.d/*_limits.conf 

Just exit the terminal and log in again and confirm with ulimit -n it will install for * users

+2
Jul 29 '15 at 7:36
source share

ULIMIT Configuration:

  • Root login
  • vi security / limits.conf
  • Record below

    Start configuring Ulimit for a website

     website soft nofile 8192 website hard nofile 8192 website soft nproc 4096 website hard nproc 8192 website soft core unlimited website hard core unlimited 
  • After changing the file, the user needs to log out and log back in to see the new values.

+2
Sep 09 '15 at 7:00
source share

tl; dr sets both soft and hard limits

I am sure that it works as intended, but I will add it here just in case. For completeness, a limit is set here (see the syntax below): /etc/security/limits.conf

 some_user soft nofile 60000 some_user hard nofile 60000 

and activated as follows: /etc/pam.d/common-session:

 session required pam_limits.so 

If you set only the hard limit, ulimit -a display the default value (1024): If you set only the soft limit ulimit -a, you will see (4096)

If you set them as ulimit -a , a soft limit will be displayed (up to a hard limit)

+2
Sep 12 '15 at 0:51
source share

I did it like this:

 echo "NEO4J_ULIMIT_NOFILE=50000" >> neo4j mv neo4j /etc/default/ 
+2
Jul 23 '16 at 14:35
source share



All Articles