7

I have a single node ElasticSearch Cluster in local. I am unable to start elasticsearch service. Getting this error:

[bhatr@LRVCEM27547]~/elasticsearch-6.8.8/bin% elasticsearch                                                                                          5:30AM
[2020-04-27T05:30:14,280][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [unknown] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: failed to obtain node locks, tried [[/remote/users/bhatr/elasticsearch-6.8.8/data]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-6.8.8.jar:6.8.8]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-6.8.8.jar:6.8.8]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.8.8.jar:6.8.8]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.8.8.jar:6.8.8]
        at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.8.8.jar:6.8.8]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116) ~[elasticsearch-6.8.8.jar:6.8.8]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.8.8.jar:6.8.8]
Caused by: java.lang.IllegalStateException: failed to obtain node locks, tried [[/remote/users/bhatr/elasticsearch-6.8.8/data]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?
        at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:300) ~[elasticsearch-6.8.8.jar:6.8.8]
        at org.elasticsearch.node.Node.<init>(Node.java:296) ~[elasticsearch-6.8.8.jar:6.8.8]
        at org.elasticsearch.node.Node.<init>(Node.java:266) ~[elasticsearch-6.8.8.jar:6.8.8]
        at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:212) ~[elasticsearch-6.8.8.jar:6.8.8]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:212) ~[elasticsearch-6.8.8.jar:6.8.8]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) ~[elasticsearch-6.8.8.jar:6.8.8]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-6.8.8.jar:6.8.8]
        ... 6 more

I have tried the answers of this and this post but couldn't resolve. OS: RedHat 7.5

  1. All directories in elasticsearch have write permission
  2. There is no other elastic instance running , I have confirmed through ps -ef | grep java

Please help to resolve this.

Rajeev Bhat
  • 111
  • 1
  • 9
  • 1
    See if its helpful https://opster.com/analysis/elasticsearch-lock-assertion-failed/ – Amit Apr 28 '20 at 04:21
  • 1
    Thanks for reply.Tried it but I have already checked for other running instance and there is none. I want only one node running. – Rajeev Bhat Apr 28 '20 at 04:34
  • can u delete the data folder, stop your ES process, restart your computer and try again – Amit Apr 28 '20 at 04:36
  • Do I need to delete the contents of data folder or the data folder itself? – Rajeev Bhat Apr 28 '20 at 04:40
  • delete the entire data folder – Amit Apr 28 '20 at 04:40
  • 1
    Thank you very much. After second time I rebooted it is working. – Rajeev Bhat Apr 28 '20 at 05:02
  • Great thanks for confirmation, let me write this answer so that will be useful for community, and you can mark it as answer :) – Amit Apr 28 '20 at 05:07
  • 1
    I had a similar problem when I upgraded to the latest Helm chart for SonarQube. I had to scale the pods down to zero and then when I did the upgrade, it worked. Looks like the chart needs to be updated. – Daniel Eagle Apr 28 '21 at 21:54

2 Answers2

2

Deleted the data folder and rebooted my machine. Now it is working.

Rajeev Bhat
  • 111
  • 1
  • 9
0

If you are using elasticsearch in kubernetes, which basically use a PV. And if you are using NFS as PV, then may try below on NFS server

systemctl start rpc-statd