elasticsearch failed to obtain node locks

0x00 事件

重启服务器后,启动 elasticsearch 失败,在日志中观察到以下错误:

[2019-10-25T17:29:54,639][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [test-machine] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: failed to obtain node locks, tried [[/var/lib/elasticsearch/sunaw-cluster]] 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:140) ~[elasticsearch-6.4.3.jar:6.4.3]
    at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) ~[elasticsearch-6.4.3.jar:6.4.3]
    at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.4.3.jar:6.4.3]
    at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.4.3.jar:6.4.3]
    at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.4.3.jar:6.4.3]
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.4.3.jar:6.4.3]
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) ~[elasticsearch-6.4.3.jar:6.4.3]
Caused by: java.lang.IllegalStateException: failed to obtain node locks, tried [[/var/lib/elasticsearch/sunaw-cluster]] 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:247) ~[elasticsearch-6.4.3.jar:6.4.3]
    at org.elasticsearch.node.Node.<init>(Node.java:274) ~[elasticsearch-6.4.3.jar:6.4.3]
    at org.elasticsearch.node.Node.<init>(Node.java:256) ~[elasticsearch-6.4.3.jar:6.4.3]
    at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:213) ~[elasticsearch-6.4.3.jar:6.4.3]
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:213) ~[elasticsearch-6.4.3.jar:6.4.3]
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:326) ~[elasticsearch-6.4.3.jar:6.4.3]
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-6.4.3.jar:6.4.3]

0x01 解决

在一些文章的帮助下查询了进程,发现了另一个 elasticsearch 服务,虽然不清楚是如何启动的,kill 掉即可:

[[email protected] /usr/share/elasticsearch]#ps -ef | grep elasticsearch
elastic+  1113     1 24 17:17 ?        00:03:19 /bin/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Djava.io.tmpdir=/tmp/elasticsearch.O6OSL2h2 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/lib/elasticsearch -XX:ErrorFile=/var/log/elasticsearch/hs_err_pid%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -Xloggc:/var/log/elasticsearch/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=32 -XX:GCLogFileSize=64m -Des.path.home=/usr/share/elasticsearch -Des.path.conf=/etc/elasticsearch -Des.distribution.flavor=default -Des.distribution.type=rpm -cp /usr/share/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch -p /var/run/elasticsearch/elasticsearch.pid --quiet
elastic+  5193  1113  0 17:17 ?        00:00:00 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller
root     14123 10944  0 17:30 pts/0    00:00:00 grep --color=auto elasticsearch
[[email protected] /usr/share/elasticsearch]#kill -9 1113
[[email protected] /usr/share/elasticsearch]#ps -ef | grep elasticsearch
root     14151 10944  0 17:31 pts/0    00:00:00 grep --color=auto elasticsearch

kill 掉之后,再启动 elasticsearch,没有再出现此错误,服务也正常运行。

原文地址:https://www.cnblogs.com/nnylee/p/11758071.html

时间: 2024-11-06 07:14:50

elasticsearch failed to obtain node locks的相关文章

elastic search报错——“failed to obtain node locks”

启动时报错信息: 这里写图片描述 寻找主要信息:failed to obtain node locks这里写图片描述简单理解为:绑定节点失败!!! 百度后,好多人同样遇到了这个问题,导致的原因可能是因为之前运行的es还没有正常关闭. 第一步:通过命令:ps aux | grep 'elastic' 进行查看.如下图:这里写图片描述 第二步:通过命令: kill -9 进程号 关闭此进程. 第三步:重新启动es../bin/elasticsearch 原文地址:https://www.cnblog

Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection;

解决报错 This application has no explicit mapping for /error, so you are seeing this as a fallback. Tue Jan 07 21:06:43 CST 2020 There was an unexpected error (type=Internal Server Error, status=500). nested exception is org.apache.ibatis.exceptions.Pers

TableView报错 failed to obtain a cell from its dataSource

检查原因1:是否已经注册cell p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #3495af } span.s1 { color: #000000 } span.s2 { color: #0433ff } span.s3 { } span.s4 { color: #b4261a } [self.tableView registerNib:[UINib nibWithNibName:NSStringFromC

Elasticsearch 错误小结

报错: [2019-01-15T12:36:59,779][ERROR][o.e.b.Bootstrap ] Exception java.lang.IllegalStateException: failed to obtain node locks, tried [[/mnt/elasticsearch/data/my-application]] with lock id [0]; maybe these locations are not writable or multiple nodes

elasticsearch 安装head

git clone https://github.com/mobz/elasticsearch-head.git yum install nodejs npm install 修改Elasticsearch配置,允许跨域访问,修改后重新启动Elasticsearch vi elasticsearch-7.1.1/config/elasticsearch.yml #添加如下配置,支持跨域访问 http.cors.enabled: truehttp.cors.allow-origin: "*&quo

elk6.3 centos集群搭建 head插件安装

版本elk均为6.3+centos7.0 准备工作 官网下载elk6.3的linux环境的压缩包,sftp上传 下载对应的head插件sftp上传到指定目录 tar.gz文件解压 tar -zxvf filename -C dirname zip文件 安装zip软件 unzip filename -d dirname 1.root用户不能启动elasticsearch 参考:http://www.cnblogs.com/ding2016/p/6879584.html https://www.cn

elk报错

1.elasticsearch启动失败如下: [[email protected] home]# /home/elasticsearch-6.3.0/bin/elasticsearch [2019-02-11T07:15:14,874][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main] org.elasticsearch.bootstrap.StartupExcep

elasticsearch在kubernetes中持久化集群部署

背景 Javashop电商系统的商品索引是使用的elasticsearch,对于高可用的要求有两个重要的考量: 1.集群化 2.可扩容 3.冗灾 冗灾就要实现es的持久化,要考虑到es宕机的情况,当es因不可抗因素挂掉了,当我们再恢复了es的运行后,商品索引也要随之 一起恢复. 本文着重讨论elasticsearch的持久化部署方案,当然提供在方案也支持了集群及扩容. 思路 1.数据的存储 在k8s中的持久化部署不可避免的要用到持久卷,我们采用nfs方式的持久卷来存储es数据. 持久卷的详细介绍

Elasticsearch基础教程

http://blog.csdn.net/cnweike/article/details/33736429 基础概念 Elasticsearch有几个核心概念.从一開始理解这些概念会对整个学习过程有莫大的帮助. 接近实时(NRT) Elasticsearch是一个接近实时的搜索平台.这意味着,从索引一个文档直到这个文档可以被搜索到有一个轻微的延迟(一般是1秒). 集群(cluster) 一个集群就是由一个或多个节点组织在一起.它们共同持有你整个的数据.并一起提供索引和搜索功能.一个集群由一个唯一