Can't start service elasticsearch

[root@localhost ~]# systemctl status elasticsearch
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2017-09-15 05:20:41 ICT; 46ms ago
Docs: http://www.elastic.co
Process: 4336 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet -Edefault.path.logs=${LOG_DIR} -Edefault.path.data=${DATA_DIR} -Edefault.path.conf=${CONF_DIR} (code=exited, status=1/FAILURE)
Process: 4335 ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec (code=exited, status=0/SUCCESS)
Main PID: 4336 (code=exited, status=1/FAILURE)

Sep 15 05:20:41 localhost.localdomain elasticsearch[4336]: at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:114)
Sep 15 05:20:41 localhost.localdomain elasticsearch[4336]: at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67)
Sep 15 05:20:41 localhost.localdomain elasticsearch[4336]: at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122)
Sep 15 05:20:41 localhost.localdomain elasticsearch[4336]: at org.elasticsearch.cli.Command.main(Command.java:88)
Sep 15 05:20:41 localhost.localdomain elasticsearch[4336]: at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91)
Sep 15 05:20:41 localhost.localdomain elasticsearch[4336]: at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84)
Sep 15 05:20:41 localhost.localdomain elasticsearch[4336]: Refer to the log for complete error details.
Sep 15 05:20:41 localhost.localdomain systemd[1]: elasticsearch.service: main process exited, code=exited, status=1/FAILURE
Sep 15 05:20:41 localhost.localdomain systemd[1]: Unit elasticsearch.service entered failed state.
Sep 15 05:20:41 localhost.localdomain systemd[1]: elasticsearch.service failed.
[root@localhost ~]#

Can you confirm that elastic has access to the directories referred to by these env variables:

  • ${LOG_DIR}
  • ${DATA_DIR}
  • ${CONF_DIR}

Elasticsearch home directory

ES_HOME=/usr/share/elasticsearch

Elasticsearch Java path

JAVA_HOME=/opt/jdk1.8.0_141

Elasticsearch configuration directory

CONF_DIR=/etc/elasticsearch

Elasticsearch data directory

DATA_DIR=/var/lib/elasticsearch

Elasticsearch logs directory

LOG_DIR=/var/log/elasticsearch

Elasticsearch PID directory

PID_DIR=/var/run/elasticsearch

Additional Java OPTS

ES_JAVA_OPTS="${LOG_DIR} -Edefault.path.data=${DATA_DIR} -Edefault.path.conf=${CONF_DIR}"

Configure restart on package upgrade (true, every other setting will lead to not restarting)

#RESTART_ON_UPGRADE=true

===========================================================================

● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2017-09-15 22:07:01 ICT; 728ms ago
Docs: http://www.elastic.co
Process: 2865 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet -Edefault.path.logs=${LOG_DIR} -Edefault.path.data=${DATA_DIR} -Edefault.path.conf=${CONF_DIR} (code=exited, status=1/FAILURE)
Process: 2864 ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec (code=exited, status=0/SUCCESS)
Main PID: 2865 (code=exited, status=1/FAILURE)
hi thank you for answer new error below

Sep 15 22:07:00 localhost.localdomain systemd[1]: Starting Elasticsearch...
Sep 15 22:07:00 localhost.localdomain systemd[1]: Started Elasticsearch.
Sep 15 22:07:01 localhost.localdomain elasticsearch[2865]: Error: Could not find or load main class ${LOG_DIR}
Sep 15 22:07:01 localhost.localdomain systemd[1]: elasticsearch.service: main process exited, code=exited, status=...ILURE
Sep 15 22:07:01 localhost.localdomain systemd[1]: Unit elasticsearch.service entered failed state.
Sep 15 22:07:01 localhost.localdomain systemd[1]: elasticsearch.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

Try to create all the paths manually. Check your config (elasticsearch.yml) once. Even if it is not able to start try to run it as a process.

have you done any configuration changes in elasticsearch.yml file?
on which version you are working?

Is there anything in the Elasticsearch logs?

@TK_CyberOne
seems that there is some configuration issue.
please share your configuration file . is there changes you have done in this file?

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