Elasticsearch run as service

I installed elasticsearch with a tar.gz package.
I want to run as a service so that es can run automatically when the system reboots.
How should I set it up?

elasticsearch: 7.6
os: centos7

Instead of using rpm, we need a method that runs as a service in the current installation plan.

I don't fully understand, why can't you use RPM?

If you cannot use it, you can properly take a look at the RPM and reuse the systemd startup script from the package.

Yes I changed the installation method to rpm.

I have two questions.
First, a bootstrap check fail occurs.
Error: memory locking requested for elasticsearch process but memoty is not locked.
Here is my config.
Which settings should I add?

(1) /etc/security/limits.conf
elasticsearch - nofile 65336
elasticsearch soft memlock unlimited
elasticsearch hard memlock unlimited
elasticsearch - nproc 4096

(2) /usr/lib/systemd/system/elasticsearch.service
LimitMEMLOCK=infinity

(3) /etc/sysctl.conf
vm.max_map_count=262144

Second, I changed the path.logs(/data) setting, but gc.log is still logged in /var/ log.
How should I set it so that gc.log can also be written to the changed path(/data)?

See https://www.elastic.co/guide/en/elasticsearch/reference/7.6/setup-configuration-memory.html

Did you check that setup and not only the configuration files?

Regarding the gc.log, check the jvm.options file.

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