Elasticsearch, Failed to obtain node lock, is the following location writable

后端 未结 13 2292
予麋鹿
予麋鹿 2020-12-05 12:45

Elasticsearch won\'t start using ./bin/elasticsearch. It raises the following exception:

- ElasticsearchIllegalStateException[Failed to obtain n         


        
相关标签:
13条回答
  • 2020-12-05 13:11

    the reason is another instance is running!
    first find the id of running elastic.

    ps aux | grep 'elastic'
    

    then kill using kill -9 <PID_OF_RUNNING_ELASTIC>.
    There were some answers to remove node.lock file but that didn't help since the running instance will make it again!

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

    In my situation I had wrong permissions on the ES dir folder. Setting correct owner solved it.

    # change owner
    chown -R elasticsearch:elasticsearch /data/elasticsearch/
    
    # to validate
    ls /data/elasticsearch/ -la
    # prints    
    # drwxr-xr-x 2 elasticsearch elasticsearch 4096 Apr 30 14:54 CLUSTER_NAME
    
    0 讨论(0)
  • 2020-12-05 13:19

    chown -R elasticsearch:elasticsearch /var/lib/elasticsearch

    It directly shows it doesn't have permission to obtain a lock. So need to give permissions.

    0 讨论(0)
  • 2020-12-05 13:21

    As with many others here replying, this was caused by wrong permissions on the directory (not owned by the elasticsearch user). In our case it was caused by uninstalling Elasticsearch and reinstalling it (via yum, using the official repositories).

    As of this moment, the repos do not delete the nodes directory when they are uninstalled, but they do delete the elasticsearch user/group that owns it. So then when Elasticsearch is reinstalled, a new, different elasticsearch user/group is created, leaving the old nodes directory still present, but owned by the old UID/GID. This then conflicts and causes the error.

    A recursive chown as mentioned by @oleksii is the solution.

    0 讨论(0)
  • 2020-12-05 13:22

    To add to the above answers there could be some other scenarios in which you can get the error.In fact I had done a update from 5.5 to 6.3 for elasticsearch.I have been using the docker compose setup with named volumes for data directories.I had to do a docker volume prune to remove the stale ones.After doing that I was no longer facing the issue.

    0 讨论(0)
  • 2020-12-05 13:24

    Try the following: 1. find the port 9200, e.g.: lsof -i:9200 This will show you which processes use the port 9200. 2. kill the pid(s), e.g. repeat kill -9 pid for each PID that the output of lsof showed in step 1 3. restart elasticsearch, e.g. elasticsearch

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