Фиксим тривиальную ошибку запуска ElasticSearch на macOS
При попытке поднять приложение с прикрученным к нему ElasticSearch на локальной машине (macOS Catalina) я получил следующую ошибку:
elasticsearch.1 | [][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [unknown] uncaught exception in thread [main] elasticsearch.1 | org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: failed to obtain node locks, tried [[/usr/local/var/lib/elasticsearch]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])? elasticsearch.1 | at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-6.8.5.jar:6.8.5] elasticsearch.1 | at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-6.8.5.jar:6.8.5] elasticsearch.1 | at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.8.5.jar:6.8.5] elasticsearch.1 | at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.8.5.jar:6.8.5] elasticsearch.1 | at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.8.5.jar:6.8.5] elasticsearch.1 | at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116) ~[elasticsearch-6.8.5.jar:6.8.5] elasticsearch.1 | at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.8.5.jar:6.8.5] elasticsearch.1 | Caused by: java.lang.IllegalStateException: failed to obtain node locks, tried [[/usr/local/var/lib/elasticsearch]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])? elasticsearch.1 | at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:300) ~[elasticsearch-6.8.5.jar:6.8.5] elasticsearch.1 | at org.elasticsearch.node.Node.<init>(Node.java:296) ~[elasticsearch-6.8.5.jar:6.8.5] elasticsearch.1 | at org.elasticsearch.node.Node.<init>(Node.java:266) ~[elasticsearch-6.8.5.jar:6.8.5] elasticsearch.1 | at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:212) ~[elasticsearch-6.8.5.jar:6.8.5] elasticsearch.1 | at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:212) ~[elasticsearch-6.8.5.jar:6.8.5] elasticsearch.1 | at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) ~[elasticsearch-6.8.5.jar:6.8.5] elasticsearch.1 | at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-6.8.5.jar:6.8.5] elasticsearch.1 | ... 6 more elasticsearch.1 | exited with code 1 system | sending SIGTERM to all processes front.1 | exited with code 1 back.1 | terminated by SIGTERM
Все оказалось довольно просто - какой-то процесс ES уже был запущен.
Ищем нужный процесс:
ps aux | grep 'java'
Выбираем нужный PID процесса и убиваем его:
kill -9 [PID процесса]