# Elasticsearch run as service

**URL:** <https://discuss.elastic.co/t/elasticsearch-run-as-service/223369>\
**Category:** Elasticsearch\
**Created:** [March 12, 2020, 3:37pm UTC](https://discuss.elastic.co/t/elasticsearch-run-as-service/223369 "2020-03-12T15:37:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yungyoung\_Ok](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yungyoung_ok/32/43465_2.png) [@Yungyoung\_Ok](https://discuss.elastic.co/u/Yungyoung_Ok)\
**Post date:** [March 12, 2020, 3:37pm UTC](https://discuss.elastic.co/t/elasticsearch-run-as-service/223369/1 "2020-03-12T15:37:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [March 13, 2020, 4:50pm UTC](https://discuss.elastic.co/t/elasticsearch-run-as-service/223369/2 "2020-03-13T16:50:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Yungyoung\_Ok](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yungyoung_ok/32/43465_2.png) [@Yungyoung\_Ok](https://discuss.elastic.co/u/Yungyoung_Ok)\
**Post date:** [March 14, 2020, 4:07pm UTC](https://discuss.elastic.co/t/elasticsearch-run-as-service/223369/3 "2020-03-14T16:07:57Z")

</div>

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)?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [March 16, 2020, 1:49pm UTC](https://discuss.elastic.co/t/elasticsearch-run-as-service/223369/4 "2020-03-16T13:49:37Z")

</div>

See [https://www.elastic.co/guide/en/elasticsearch/reference/7.6/setup-configuration-memory.html](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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 13, 2020, 1:49pm UTC](https://discuss.elastic.co/t/elasticsearch-run-as-service/223369/5 "2020-04-13T13:49:45Z")

</div>

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