Failed to start Elasticsearch. (code=exited, status=1/FAILURE)

Hallo

i was try to make a single node of elasticsearch on my centos 7. In the first installation of elasticsearch after i've done install centos 7.its just fine,the elasticsearch works very well.

But im very confused ,the faillure always attempts me after i try to reinstalling elasticsearch for the second times. I had to Re-Installing of my centos 7 if wanted the elasticsearch works. Pls help!.

There is the error

[root@gilang ~]# systemctl restart elasticsearch
Job for elasticsearch.service failed because the control process exited with error code. 
See "systemctl status elasticsearch.service" and "journalctl -xe" for details.
[root@gilang ~]# systemctl status elasticsearch -l
● elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor 
preset: disabled)
   Active: failed (Result: exit-code) since Wed 2020-02-05 11:16:52 WIB; 4s ago
     Docs: http://www.elastic.co
  Process: 2506 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p 
${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=1/FAILURE)
 Main PID: 2506 (code=exited, status=1/FAILURE)

Feb 05 11:16:49 gilang systemd[1]: Starting Elasticsearch...
Feb 05 11:16:50 gilang elasticsearch[2506]: OpenJDK 64-Bit Server VM warning: Option 
UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a         
future release.
Feb 05 11:16:52 gilang systemd[1]: elasticsearch.service: main process exited, 
code=exited, status=1/FAILURE
Feb 05 11:16:52 gilang systemd[1]: Failed to start Elasticsearch.
Feb 05 11:16:52 gilang systemd[1]: Unit elasticsearch.service entered failed state.
Feb 05 11:16:52 gilang systemd[1]: elasticsearch.service failed.

There is my configuration

elasticsearch.yml

# ======================== Elasticsearch Configuration=========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
#cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: gilang
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /var/lib/elasticsearch
#
# Path to log files:
#
path.logs: /var/log/elasticsearch
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 100.100.200.150
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
discovery.seed_hosts: ["gilang",]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["gilang"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
#
#---------------------------------- X_PACK -------------------------------------
action.auto_create_index: .monitoring*,.watches,.triggered_watches,.watcher-history*,.ml*

Elasticsearch.log

indent preformatted text by 4 spaces at org.apache.lucene.store.BaseDirectory.obtainLock(BaseDirectory.java:45) ~[lucene-core-8.3.0.jar:8.3.0 2aa586909b911e66e1d8863aa89f173d69f86cd2 - ishan - 2019-10-25 23:10:03]
    at org.elasticsearch.env.NodeEnvironment$NodeLock.<init>(NodeEnvironment.java:214) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:269) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.node.Node.<init>(Node.java:273) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.node.Node.<init>(Node.java:253) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:241) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:241) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:369) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.5.2.jar:7.5.2]

Please format your code, logs or configuration files using </> icon as explained in this guide and not the citation button. It will make your post more readable.

Or use markdown style like:

```
CODE
```

This is the icon to use if you are not using markdown format:

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.
Please update your post.

Also please share the full logs of elasticsearch.

Thanks for your respond and the informations above how to post correctly

here is for the logs

tail -f /var/log/elasticsearch/elasticsearch.log

 at org.apache.lucene.store.BaseDirectory.obtainLock(BaseDirectory.java:45) ~[lucene-core-8.3.0.jar:8.3.0 2aa586909b911e66e1d8863aa89f173d69f86cd2 - ishan - 2019-10-25 23:10:03]
    at org.elasticsearch.env.NodeEnvironment$NodeLock.<init>(NodeEnvironment.java:214) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:269) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.node.Node.<init>(Node.java:273) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.node.Node.<init>(Node.java:253) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:241) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:241) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:369) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.5.2.jar:7.5.2]
    ... 6 more

Could you post the full logs please ?

[2020-02-05T11:16:52,643][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [gilang] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: failed to obtain node locks, tried [[/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])?
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:125) ~[elasticsearch-cli-7.5.2.jar:7.5.2]
    at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.5.2.jar:7.5.2]
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.5.2.jar:7.5.2]
Caused by: java.lang.IllegalStateException: failed to obtain node locks, tried [[/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])?
    at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:299) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.node.Node.<init>(Node.java:273) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.node.Node.<init>(Node.java:253) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:241) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:241) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:369) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.5.2.jar:7.5.2] ...6 more
Caused by: java.io.IOException: failed to obtain lock on /var/lib/elasticsearch/nodes/0
    at org.elasticsearch.env.NodeEnvironment$NodeLock.<init>(NodeEnvironment.java:221) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:269) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.node.Node.<init>(Node.java:273) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.node.Node.<init>(Node.java:253) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:241) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:241) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:369) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.5.2.jar:7.5.2]
    ... 6 more

Caused by: java.nio.file.AccessDeniedException: /var/lib/elasticsearch/nodes/0/node.lock
    at sun.nio.fs.UnixException.translateToIOException(UnixException.java:90) ~[?:?]
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) ~[?:?]
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116) ~[?:?]
    at sun.nio.fs.UnixFileSystemProvider.newFileChannel(UnixFileSystemProvider.java:182) ~[?:?]
    at java.nio.channels.FileChannel.open(FileChannel.java:292) ~[?:?]
    at java.nio.channels.FileChannel.open(FileChannel.java:345) ~[?:?]
    at org.apache.lucene.store.NativeFSLockFactory.obtainFSLock(NativeFSLockFactory.java:125) ~[lucene-core-8.3.0.jar:8.3.0 2aa586909b911e66e1d8863aa89f173d69f86cd2 - ishan - 2019-10-25 23:10:03]
    at org.apache.lucene.store.FSLockFactory.obtainLock(FSLockFactory.java:41) ~[lucene-core-8.3.0.jar:8.3.0 2aa586909b911e66e1d8863aa89f173d69f86cd2 - ishan - 2019-10-25 23:10:03]
    at org.apache.lucene.store.BaseDirectory.obtainLock(BaseDirectory.java:45) ~[lucene-core-8.3.0.jar:8.3.0 2aa586909b911e66e1d8863aa89f173d69f86cd2 - ishan - 2019-10-25 23:10:03]
    at org.elasticsearch.env.NodeEnvironment$NodeLock.<init>(NodeEnvironment.java:214) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:269) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.node.Node.<init>(Node.java:273) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.node.Node.<init>(Node.java:253) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:241) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:241) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:369) ~[elasticsearch-7.5.2.jar:7.5.2]
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.5.2.jar:7.5.2]
    ... 6 more

It seems that elasticsearch is already running.

how it can be running while the status of elasticsearch is failed to start with error

(code=exited, status=1/FAILURE)

I found the problem.

after i deleting

/var/lib/elasticsearch/nodes/0/node.lock

and I reinstalling the elasticsearch. Its running active again

but please,can u explain how can be happend?

1 Like

Have you checked prior via jps if another process is running?

there is nothing running aplication except firewall
and i'have already add firewall port for elastic,kibana,and logstash

is the network.host: 100.100.200.150 is your system's IP address.?

Sagar_mandal

yes. There is my segment IP address i make on my system network at my home

okay try to add..

transport.host: localhost  

transport.tcp.port: 9300 

in your elasticsearch.yml and restart the service of elasticsearch

1 Like

Thanks for the help

for right now,my elasticsearch was running active

but i just want to know
how it can be work after i'm deleting

/var/lib/elasticsearch/nodes/0/node.lock

can u give some reason?

When a node is running it creates this file. Which prevents you from running another instance by mistake on the same machine.
When the node stops, this file is removed normally.

ohhh i see

Thanks very much for the information.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.