Unable to start Elasticsearch 7.4.2 as service while installing with zip file in centos

Hello,

I am not able to start elastic search 7.4.2 as service while using elastic search-7.4.2.zip file in centos.

Process of instalaltion:
Step1 : download zip file
Step 2: Extract in folder
Step3 : Create service (elasticsearch-7.4.2.service) file in /usr/lib/systemd/system
service file content is given below -
[Unit]
Description=Elasticsearch-7.4.2
Documentation=http://www.elastic.co
Wants=network-online.target
After=network-online.target
[Service]
Environment=ES_HOME=/opt/elasticsearch-7.4.2
Environment=CONF_DIR=/opt/elasticsearch-7.4.2/config
Environment=DATA_DIR=/opt/elasticsearch-7.4.2/data
Environment=LOG_DIR=/opt/elasticsearch-7.4.2/logs
Environment=PID_DIR=/opt/elasticsearch-7.4.2
EnvironmentFile=-/opt/elasticsearch-7.4.2/elasticsearch-7.4.2

WorkingDirectory=/opt/elasticsearch-7.4.2
User=elasticsearch-7.4.2
Group=elasticsearch-7.4.2
#ExecStartPre=/opt/elasticsearch-7.4.2/bin/elasticsearch-systemd-pre-exec
ExecStart=/opt/elasticsearch-7.4.2/bin/elasticsearch -p {PID_DIR}/elasticsearch.pid --quiet -Edefault.path.logs={LOG_DIR} -Edefault.path.data={DATA_DIR} -Edefault.path.conf={CONF_DIR}

StandardOutput is configured to redirect to journalctl since

some error messages may be logged in standard output before

elasticsearch logging system is initialized. Elasticsearch

stores its logs in /var/log/elasticsearch and does not use

journalctl by default. If the user also want to enable journalctl

logging, user can simply remove the "quiet" option from ExecStart.

StandardOutput=journal
StandardError=inherit

Specifies the maximum file descriptor number that can be opened by this process

LimitNOFILE=65536

Specifies the maximum number of processes

LimitNPROC=2048

Specifies the maximum size of virtual memory

LimitAS=infinity

Specifies the maximum file size

LimitFSIZE=infinity

Specifies the maximum file size

LimitFSIZE=infinity

Disable timeout logic and wait until process is stopped

TimeoutStopSec=0

SIGTERM signal is used to stop the Java process

KillSignal=SIGTERM

Send the signal only to the JVM rather than its control group

KillMode=process

Java process is never killed

SendSIGKILL=no

When a JVM receives a SIGTERM signal it exits with code 143

SuccessExitStatus=143
[Install]
WantedBy=multi-user.target

Built for distribution-7.4.2 (distribution)

After starting elastic search
sudo systemctl start elasticsearch-7.4.2.service , i am getting error like below

sudo systemctl status elasticsearch-7.4.2.service
elasticsearch-7.4.2.service: main process exited, code=exited, status=1/FAILURE
Unit elasticsearch-7.4.2.service entered failed state.
elasticsearch-7.4.2.service failed.

could you please help me out of this .

Welcome!

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.

Could you share elasticsearch logs as well?

Hi,

Thanks for your reply.
log is not generating i am just sharing my service file and folder structure .

Check once let me know if you need anything.

Thanks,

Abhishek

Please don't post images of text as they are hard to read, may not display correctly for everyone, and are not searchable.

Instead, paste the text and format it with </> icon or pairs of triple backticks (```), and check the preview window to make sure it's properly formatted before posting it. This makes it more likely that your question will receive a useful answer.

It would be great if you could update your post to solve this.

May be something is wrong in your elasticsearch.yml file? Did you modify it?

Is it possible to use instead the rpm package which should configure everything for you?
So follow the instructions in this guide: https://www.elastic.co/guide/en/elasticsearch/reference/current/rpm.html

Hi,
Thanks for your reply,
Yes already i have verified with rpm , it is working fine but my challenge is use zip file where need to create service file manually.

I have mentioned two scenario for zip file
Scenario 1:
after installing execute ./elasticsearch & from bin file on that time it was working fine.

Scenario 2:
After installing and creating service file, execute the below command
systemctl start elasticsearch-7.4.2.service
systemctl status elasticsearch-7.4.2.service

on that time i am getting error
elasticsearch-7.4.2.service - Elasticsearch-7.4.2
Loaded: loaded (/usr/lib/systemd/system/elasticsearch-7.4.2.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2020-03-05 10:48:19 IST; 14s ago
Docs: http://www.elastic.co
Process: 24229 ExecStart=/opt/elasticsearch-7.4.2/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)
Main PID: 24229 (code=exited, status=1/FAILURE)

elasticsearch-7.4.2.service: main process exited, code=exited, status=1/FAILURE
Unit elasticsearch-7.4.2.service entered failed state.
elasticsearch-7.4.2.service failed

Great. Wondering why you don't want to use the best practices here.
May be you should look at the script that rpm created and uses them as a template?

I'm not on the ops side so I can't help more I'm afraid. May be others?

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