# Guarding from double-start

**URL:** <https://discuss.elastic.co/t/guarding-from-double-start/18230>\
**Category:** Elasticsearch\
**Created:** [June 20, 2014, 2:21pm UTC](https://discuss.elastic.co/t/guarding-from-double-start/18230 "2014-06-20T14:21:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew\_Gaydenko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_gaydenko/32/914_2.png) [@Andrew\_Gaydenko](https://discuss.elastic.co/u/Andrew_Gaydenko)\
**Post date:** [June 20, 2014, 2:21pm UTC](https://discuss.elastic.co/t/guarding-from-double-start/18230/1 "2014-06-20T14:21:08Z")

</div>

There were a couple of times during development workflow I have started ES  
script the second time. It results in red status (I use Elastic HQ) and  
not-working. So I'm forced to regenerate all indexes (with all test data)  
again. It takes noticeable time.

At the moment I use this script

ES\_MAX\_MEM="512M"  
export ES\_MAX\_MEM  
cd /ES-dir/bin  
./elasticsearch.in.sh  
./elasticsearch -f &

under Linux to start ES. Can you. please, suggest a trick to avoid falling  
in red?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a79fba10-3fad-4c76-bc19-d744c2f79ef2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a79fba10-3fad-4c76-bc19-d744c2f79ef2%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Maciej\_Dziardziel](https://avatars.discourse-cdn.com/v4/letter/m/d9b06d/32.png) [@Maciej\_Dziardziel](https://discuss.elastic.co/u/Maciej_Dziardziel)\
**Post date:** [June 20, 2014, 2:49pm UTC](https://discuss.elastic.co/t/guarding-from-double-start/18230/2 "2014-06-20T14:49:04Z")

</div>

use start-stop-daemon or adapt /etc/init.d/elasticsearch to set up pidfile  
guarding es instance. Or just run this way:  
pgrep -f elasticsearch || ./start\_es.sh

On Friday, June 20, 2014 3:21:08 PM UTC+1, Andrew Gaydenko wrote:

> There were a couple of times during development workflow I have started ES  
> script the second time. It results in red status (I use Elastic HQ) and  
> not-working. So I'm forced to regenerate all indexes (with all test data)  
> again. It takes noticeable time.
> 
> At the moment I use this script
> 
> ES\_MAX\_MEM="512M"  
> export ES\_MAX\_MEM  
> cd /ES-dir/bin  
> ./elasticsearch.in.sh  
> ./elasticsearch -f &
> 
> under Linux to start ES. Can you. please, suggest a trick to avoid falling  
> in red?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/d78daaaf-305b-45b4-ad9a-e34cf1adbb22%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d78daaaf-305b-45b4-ad9a-e34cf1adbb22%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [June 20, 2014, 2:53pm UTC](https://discuss.elastic.co/t/guarding-from-double-start/18230/3 "2014-06-20T14:53:01Z")

</div>

You can either use the startup scripts that come with the package when you  
install via apt/yum [1] or use the service wrapper [2].

[1]

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

[2] [GitHub - elastic/elasticsearch-servicewrapper: A service wrapper on top of elasticsearch](https://github.com/elasticsearch/elasticsearch-servicewrapper)

--  
Ivan

On Fri, Jun 20, 2014 at 7:49 AM, Maciej Dziardziel [fiedzia@gmail.com](mailto:fiedzia@gmail.com)  
wrote:

> use start-stop-daemon or adapt /etc/init.d/elasticsearch to set up pidfile  
> guarding es instance. Or just run this way:  
> pgrep -f elasticsearch || ./start\_es.sh
> 
> On Friday, June 20, 2014 3:21:08 PM UTC+1, Andrew Gaydenko wrote:
> 
> > There were a couple of times during development workflow I have started  
> > ES script the second time. It results in red status (I use Elastic HQ) and  
> > not-working. So I'm forced to regenerate all indexes (with all test data)  
> > again. It takes noticeable time.
> > 
> > At the moment I use this script
> > 
> > ES\_MAX\_MEM="512M"  
> > export ES\_MAX\_MEM  
> > cd /ES-dir/bin  
> > ./elasticsearch.in.sh  
> > ./elasticsearch -f &
> > 
> > under Linux to start ES. Can you. please, suggest a trick to avoid  
> > falling in red?
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/d78daaaf-305b-45b4-ad9a-e34cf1adbb22%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d78daaaf-305b-45b4-ad9a-e34cf1adbb22%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/d78daaaf-305b-45b4-ad9a-e34cf1adbb22%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/d78daaaf-305b-45b4-ad9a-e34cf1adbb22%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDQMVO4sf-%3Dgq\_cnQRX6cTP1RG7\_HquR\_tAoVa6A\_VoFg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDQMVO4sf-%3Dgq_cnQRX6cTP1RG7_HquR_tAoVa6A_VoFg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Andrew\_Gaydenko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_gaydenko/32/914_2.png) [@Andrew\_Gaydenko](https://discuss.elastic.co/u/Andrew_Gaydenko)\
**Post date:** [June 20, 2014, 2:54pm UTC](https://discuss.elastic.co/t/guarding-from-double-start/18230/4 "2014-06-20T14:54:47Z")

</div>

On Friday, June 20, 2014 6:49:04 PM UTC+4, Maciej Dziardziel wrote:

> use start-stop-daemon or adapt /etc/init.d/elasticsearch to set up pidfile  
> guarding es instance. Or just run this way:  
> pgrep -f elasticsearch || ./start\_es.sh

Aha, thanks! - at my case pgrep is the most appropriate.

> 

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/115162b2-d679-48f0-a06e-24c47f74d079%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/115162b2-d679-48f0-a06e-24c47f74d079%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [June 20, 2014, 10:33pm UTC](https://discuss.elastic.co/t/guarding-from-double-start/18230/5 "2014-06-20T22:33:14Z")

</div>

And in your config file, set:

```
node.max_local_storage_nodes: 1

```

that way you won't start two nodes on a single instance

On 20 June 2014 16:54, Andrew Gaydenko [andrew.gaydenko@gmail.com](mailto:andrew.gaydenko@gmail.com) wrote:

> On Friday, June 20, 2014 6:49:04 PM UTC+4, Maciej Dziardziel wrote:
> 
> > use start-stop-daemon or adapt /etc/init.d/elasticsearch to set up  
> > pidfile guarding es instance. Or just run this way:  
> > pgrep -f elasticsearch || ./start\_es.sh
> 
> Aha, thanks! - at my case pgrep is the most appropriate.
> 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/115162b2-d679-48f0-a06e-24c47f74d079%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/115162b2-d679-48f0-a06e-24c47f74d079%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/115162b2-d679-48f0-a06e-24c47f74d079%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/115162b2-d679-48f0-a06e-24c47f74d079%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAPt3XKTwyNM0DGJ\_6HMoSbWmyJkSv5PObsfwGOF3tZ1a0QmJ9g%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPt3XKTwyNM0DGJ_6HMoSbWmyJkSv5PObsfwGOF3tZ1a0QmJ9g%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Andrew\_Gaydenko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_gaydenko/32/914_2.png) [@Andrew\_Gaydenko](https://discuss.elastic.co/u/Andrew_Gaydenko)\
**Post date:** [June 20, 2014, 11:20pm UTC](https://discuss.elastic.co/t/guarding-from-double-start/18230/6 "2014-06-20T23:20:46Z")

</div>

On Saturday, June 21, 2014 2:33:28 AM UTC+4, Clinton Gormley wrote:

> And in your config file, set:
> 
> ```
> node.max_local_storage_nodes: 1
> 
> ```
> 
> that way you won't start two nodes on a single instance

Great, thanks!

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/244c064e-3b2e-4b86-a2df-d1fa88617042%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/244c064e-3b2e-4b86-a2df-d1fa88617042%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 1:20am UTC](https://discuss.elastic.co/t/guarding-from-double-start/18230/7 "2017-07-06T01:20:48Z")

</div>


