# Error Running ElasticSearch

**URL:** <https://discuss.elastic.co/t/error-running-elasticsearch/3930>\
**Category:** Elasticsearch\
**Created:** [February 15, 2011, 4:46am UTC](https://discuss.elastic.co/t/error-running-elasticsearch/3930 "2011-02-15T04:46:18Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![timscott](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timscott/32/3220_2.png) [@timscott](https://discuss.elastic.co/u/timscott)\
**Post date:** [February 15, 2011, 4:46am UTC](https://discuss.elastic.co/t/error-running-elasticsearch/3930/1 "2011-02-15T04:46:18Z")

</div>

When I try to run ElasticSearch (on a Linux Ubuntu VM) I get the  
following error:

Error occurred during initialization of VM  
Could not reserve enough space for object heap

I am a Linux/Java dummy. I realize this is probably not purely an ES  
issue, but I hope someone can point me in the right direction. Thanks.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [February 15, 2011, 4:51am UTC](https://discuss.elastic.co/t/error-running-elasticsearch/3930/2 "2011-02-15T04:51:16Z")

</div>

How much memory do you have allocated for that Ubuntu VM?  
On Tuesday, February 15, 2011 at 6:46 AM, Tim Scott wrote:  
When I try to run Elasticsearch (on a Linux Ubuntu VM) I get the

> following error:
> 
> Error occurred during initialization of VM  
> Could not reserve enough space for object heap
> 
> I am a Linux/Java dummy. I realize this is probably not purely an ES  
> issue, but I hope someone can point me in the right direction. Thanks.

---

<div class="post-metadata">

**Author:** ![timscott](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timscott/32/3220_2.png) [@timscott](https://discuss.elastic.co/u/timscott)\
**Post date:** [February 15, 2011, 6:13am UTC](https://discuss.elastic.co/t/error-running-elasticsearch/3930/3 "2011-02-15T06:13:52Z")

</div>

1024Mb. Elasticsearch is the only thing running on that VM.

I should probably add that ES ran for a good while (maybe 3 days)  
before it crashed and would not start again without a reboot. In that  
3 days there was little to no activity on ES.

Surely 1Gb is enough with nothing else running? Do I need to up it?

On Feb 14, 10:51 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> How much memory do you have allocated for that Ubuntu VM?On Tuesday, February 15, 2011 at 6:46 AM, Tim Scott wrote:
> 
> When I try to run Elasticsearch (on a Linux Ubuntu VM) I get the
> 
> > following error:
> 
> > Error occurred during initialization of VM  
> > Could not reserve enough space for object heap
> 
> > I am a Linux/Java dummy. I realize this is probably not purely an ES  
> > issue, but I hope someone can point me in the right direction. Thanks.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [February 16, 2011, 2:05am UTC](https://discuss.elastic.co/t/error-running-elasticsearch/3930/4 "2011-02-16T02:05:02Z")

</div>

By default, ES configures the JVM to have ES\_MAX\_MEM of 1g. The JVM will slowly increase its size and consume that memory (thats why its recommended to have MIN and MAX set to the same value).

You can decrease ES\_MAX\_MEM to a lower value (say, 512m).  
On Tuesday, February 15, 2011 at 8:13 AM, Tim Scott wrote:

> 1024Mb. Elasticsearch is the only thing running on that VM.
> 
> I should probably add that ES ran for a good while (maybe 3 days)  
> before it crashed and would not start again without a reboot. In that  
> 3 days there was little to no activity on ES.
> 
> Surely 1Gb is enough with nothing else running? Do I need to up it?
> 
> On Feb 14, 10:51 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > How much memory do you have allocated for that Ubuntu VM?On Tuesday, February 15, 2011 at 6:46 AM, Tim Scott wrote:
> > 
> > When I try to run Elasticsearch (on a Linux Ubuntu VM) I get the
> > 
> > > following error:
> > 
> > > Error occurred during initialization of VM  
> > > Could not reserve enough space for object heap
> > 
> > > I am a Linux/Java dummy. I realize this is probably not purely an ES  
> > > issue, but I hope someone can point me in the right direction. Thanks.

---

<div class="post-metadata">

**Author:** ![timscott](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timscott/32/3220_2.png) [@timscott](https://discuss.elastic.co/u/timscott)\
**Post date:** [February 16, 2011, 5:28pm UTC](https://discuss.elastic.co/t/error-running-elasticsearch/3930/5 "2011-02-16T17:28:41Z")

</div>

Thanks Shay. What is the correct way to set this? I added the  
following line to bin/elasticsearch shell script:

ES\_MIN\_MEM = "512m"

It runs without error, but I don't know how to tell if it's working.

Another question. How come when I run ES from command line with -f  
parameter sometimes it binds to port 9201 instead of 9200? I'm  
guessing there's already a node running in the background on that  
machine, but then how do I shut down that background node?

I apologize for asking what are probably very basic Linux admin  
questions here. I have a lot to learn about basic Linux admin and ES  
admin. Thanks.

On Feb 15, 8:05 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> By default, ES configures the JVM to have ES\_MAX\_MEM of 1g. The JVM will slowly increase its size and consume that memory (thats why its recommended to have MIN and MAX set to the same value).
> 
> You can decrease ES\_MAX\_MEM to a lower value (say, 512m).
> 
> On Tuesday, February 15, 2011 at 8:13 AM, Tim Scott wrote:
> 
> > 1024Mb. Elasticsearch is the only thing running on that VM.
> 
> > I should probably add that ES ran for a good while (maybe 3 days)  
> > before it crashed and would not start again without a reboot. In that  
> > 3 days there was little to no activity on ES.
> 
> > Surely 1Gb is enough with nothing else running? Do I need to up it?
> 
> > On Feb 14, 10:51 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> > 
> > > How much memory do you have allocated for that Ubuntu VM?On Tuesday, February 15, 2011 at 6:46 AM, Tim Scott wrote:
> 
> > > When I try to run Elasticsearch (on a Linux Ubuntu VM) I get the
> 
> > > > following error:
> 
> > > > Error occurred during initialization of VM  
> > > > Could not reserve enough space for object heap
> 
> > > > I am a Linux/Java dummy. I realize this is probably not purely an ES  
> > > > issue, but I hope someone can point me in the right direction. Thanks.

---

<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:** [February 16, 2011, 5:45pm UTC](https://discuss.elastic.co/t/error-running-elasticsearch/3930/6 "2011-02-16T17:45:52Z")

</div>

On Wed, 2011-02-16 at 09:28 -0800, Tim Scott wrote:

> Thanks Shay. What is the correct way to set this? I added the  
> following line to bin/elasticsearch shell script:
> 
> ES\_MIN\_MEM = "512m"

You probably also want to set ES\_MAX\_MEM

Also, you may find the service wrapper helpful:

> **[GitHub - elastic/elasticsearch-servicewrapper: A service wrapper on top of...](https://github.com/elastic/elasticsearch-servicewrapper)**
>
> A service wrapper on top of elasticsearch. Contribute to elastic/elasticsearch-servicewrapper development by creating an account on GitHub.

Here are some instructions ( a bit out of date) for setting up ES with  
the service wrapper:

> **[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.

> Another question. How come when I run ES from command line with -f  
> parameter sometimes it binds to port 9201 instead of 9200? I'm  
> guessing there's already a node running in the background on that  
> machine, but then how do I shut down that background node?

Yes you have. Just look for a java process with 'elasticsearch' in the  
name, eg on linux:

ps ax | grep elastic

and send it a kill signal

clint

---

<div class="post-metadata">

**Author:** ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)\
**Post date:** [February 16, 2011, 5:49pm UTC](https://discuss.elastic.co/t/error-running-elasticsearch/3930/7 "2011-02-16T17:49:04Z")

</div>

Tim,

On Wed, Feb 16, 2011 at 6:28 PM, Tim Scott [tscott@lunaversesoftware.com](mailto:tscott@lunaversesoftware.com)wrote:

> Thanks Shay. What is the correct way to set this? I added the  
> following line to bin/elasticsearch shell script:
> 
> ES\_MIN\_MEM = "512m"

I am not sure about quotes. Try using ES\_MIN\_MEM=512m

> It runs without error, but I don't know how to tell if it's working.
> 
> Another question. How come when I run ES from command line with -f  
> parameter sometimes it binds to port 9201 instead of 9200? I'm  
> guessing there's already a node running in the background on that  
> machine, but then how do I shut down that background node?

If it is an ES node (note there can be running some other process, not  
related to ES at all, ES simply binds to the first empty port starting from  
9200, if not configured otherwise) then you can simply kill it or send a  
\_shutdown request over REST API, see

> **[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.

If you want to kill the process from command line then you need to know the  
PID. You can either learn this by running "ps -ef | grep elastic" or  
directly from Admin API

> **[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.

(but  
this requires scanning of returned JSON data)

> I apologize for asking what are probably very basic Linux admin  
> questions here. I have a lot to learn about basic Linux admin and ES  
> admin. Thanks.
> 
> On Feb 15, 8:05 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > By default, ES configures the JVM to have ES\_MAX\_MEM of 1g. The JVM will  
> > slowly increase its size and consume that memory (thats why its recommended  
> > to have MIN and MAX set to the same value).
> > 
> > You can decrease ES\_MAX\_MEM to a lower value (say, 512m).
> > 
> > On Tuesday, February 15, 2011 at 8:13 AM, Tim Scott wrote:
> > 
> > > 1024Mb. Elasticsearch is the only thing running on that VM.
> > 
> > > I should probably add that ES ran for a good while (maybe 3 days)  
> > > before it crashed and would not start again without a reboot. In that  
> > > 3 days there was little to no activity on ES.
> > 
> > > Surely 1Gb is enough with nothing else running? Do I need to up it?
> > 
> > > On Feb 14, 10:51 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> > > 
> > > > How much memory do you have allocated for that Ubuntu VM?On Tuesday,  
> > > > February 15, 2011 at 6:46 AM, Tim Scott wrote:
> > 
> > > > When I try to run Elasticsearch (on a Linux Ubuntu VM) I get the
> > 
> > > > > following error:
> > 
> > > > > Error occurred during initialization of VM  
> > > > > Could not reserve enough space for object heap
> > 
> > > > > I am a Linux/Java dummy. I realize this is probably not purely an  
> > > > > ES  
> > > > > issue, but I hope someone can point me in the right direction.  
> > > > > Thanks.

Regards,  
Lukas

---

<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, 4:11am UTC](https://discuss.elastic.co/t/error-running-elasticsearch/3930/8 "2017-07-06T04:11:59Z")

</div>


