I installed Neo4j on Ubuntu 12.04 using these instructions: http://www.neo4j.org/download/linux
wget -O - http://debian.neo4j.org/neotechnology.gpg.key | apt
You need to add the following entries into the /etc/security/limits.conf file
root soft nofile 40000
root hard nofile 40000
You need to start the service as root or using sudo
When you do that, the user that ends up starting the service is the root user.
If you dont have an entry in the file for the root user, then it would not work.
So, you just need to add those entries in the file and then reboot your server.
I had the same problem and that is how I was able to resolve it.
This worked for me on Arch Linux (x86_64), where prior to these modifications ulimit -n
was 1024
):
Edit /etc/pam.d/su
, add:
session required pam_limits.so
Edit both
/etc/systemd/system.conf
/etc/systemd/user.conf
add to each (whatever value you desire: I chose 100,000):
DefaultLimitNOFILE=100000
Reboot.
$ ulimit -n
100000
Based on
https://ro-che.info/articles/2017-03-26-increase-open-files-limit
https://wiki.archlinux.org/index.php/Limits.conf
You can set the hard limits in /etc/security/limits.conf and restart the server to make it into effect.
But with current session, you can run
ulimit -n 40000
The solutions posted by @israel and by @Tomasz Swider did not work for me (I am running Ubuntu 14.04). However, I could get rid of this warning by modifying the file /etc/init.d/neo4j-service
as suggested by @zwol in the comments below the question:
I added the line ulimit -n 40000
to the do_start()
method in this file. In my case this method then looks as follows:
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
ulimit -n 40000
start-stop-daemon --chuid ${NEO_USER} --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --chuid ${NEO_USER} --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
}
When I then start the service by using the command
sudo service neo4j-service start
it starts without the warning and returns the following message:
Starting Neo4j Server...WARNING: not changing user
process [9921]... waiting for server to be ready...... OK.
http://localhost:7474/ is ready.
I am not sure whether that is the way to go but as written above, that was the only solution that has worked for me so far to get rid of this warning.
EDIT:
Have not tested it, but seems there is now an easier solution available: see @Schrodinger's'Cat's answer.
I applied the changes as suggested in previous answers
root soft nofile 40000
root hard nofile 40000
neo4j soft nofile 40000
neo4j hard nofile 40000
to
/etc/security/limits.conf
Nevertheless I still got the warning about only 1024 open files being allowed. The command
ulimit -a
did show only 1024 open files allowed.
The trick was to log out of the server, then log back in. In the new session the values of the new limits-configuration were applied and I could
service neo4j-server restart
with 40.000 open files allowed.
Just check once the current value from below command ulimit -n and ulimit -a
And you can edit the value on path below /etc/security/limit.conf