Neo4j WARNING: Max 1024 open files allowed, minimum of 40 000 recommended. See the Neo4j manual

前端 未结 8 1631
孤街浪徒
孤街浪徒 2020-12-13 17:17

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         


        
相关标签:
8条回答
  • 2020-12-13 17:47

    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.

    0 讨论(0)
  • 2020-12-13 17:51

    This worked for me on Arch Linux (x86_64), where prior to these modifications ulimit -n was 1024):

    1. Edit /etc/pam.d/su, add:

      session required pam_limits.so

    2. Edit both

      /etc/systemd/system.conf

      /etc/systemd/user.conf

      add to each (whatever value you desire: I chose 100,000):

      DefaultLimitNOFILE=100000

    3. 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

    0 讨论(0)
  • 2020-12-13 17:51

    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

    0 讨论(0)
  • 2020-12-13 17:58

    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.

    0 讨论(0)
  • 2020-12-13 18:00

    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.

    0 讨论(0)
  • 2020-12-13 18:00

    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

    0 讨论(0)
提交回复
热议问题