# ElasticSearch on EC2 -- trouble with the tutorial

**URL:** <https://discuss.elastic.co/t/elasticsearch-on-ec2-trouble-with-the-tutorial/5471>\
**Category:** Elasticsearch\
**Created:** [September 28, 2011, 5:30pm UTC](https://discuss.elastic.co/t/elasticsearch-on-ec2-trouble-with-the-tutorial/5471 "2011-09-28T17:30:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rio](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rio/32/2728_2.png) [@Rio](https://discuss.elastic.co/u/Rio)\
**Post date:** [September 28, 2011, 5:30pm UTC](https://discuss.elastic.co/t/elasticsearch-on-ec2-trouble-with-the-tutorial/5471/1 "2011-09-28T17:30:21Z")

</div>

Hello!

I'm trying to follow the tutorial ([http://www.elasticsearch.org/](http://www.elasticsearch.org/)  
tutorials/2011/08/22/elasticsearch-on-ec2.html) to start an  
Elasticsearch server on a EC2 instance, but can't seem to get the  
server to start. I believe I'm following the instructions exactly.  
Every time I try, CPU usage goes to 100% and the server stops  
responding. I've tried 0.17.6 and 0.17.7 on micro basic 32bit and  
64bit instances.

On the 32bit, I was getting a warning '', but found a irc log  
directing me to start elasticsearch with the following command, which  
seemed to resolve the warning message: ES\_JAVA\_OPTS='-server' bin/  
elasticsearch -f

My configuration files are here: [https://gist.github.com/1248557](https://gist.github.com/1248557)

I'm following these steps from the tutorial

1. Launch up ec2 instance
2. Download and install ES using these command

$ wget [http://bit.ly/ES-0-17-6](http://bit.ly/ES-0-17-6)  
$ sudo unzip elasticsearch-0.17.6.zip -d /usr/local/elasticsearch  
$ cd /usr/local/elasticsearch/elasticsearch-0.17.6  
$ sudo bin/plugin -install cloud-aws

1. Configure ES [https://gist.github.com/1248557](https://gist.github.com/1248557)
2. Set environment variale ES\_MAX\_MEM=500m and EX\_MIN\_MEM=256m  
(roubly half of my instance memory)
3. Start wtih sudo bin/elasticsearch -f

Any thoughts on what I'm doing wrong?

Thanks for all your help!

---

<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:** [September 28, 2011, 5:38pm UTC](https://discuss.elastic.co/t/elasticsearch-on-ec2-trouble-with-the-tutorial/5471/2 "2011-09-28T17:38:14Z")

</div>

Hiya

> 1. Configure ES [elasticsearch configuration fail · GitHub](https://gist.github.com/1248557)
> 2. Set environment variale ES\_MAX\_MEM=500m and EX\_MIN\_MEM=256m  
> (roubly half of my instance memory)

I assume you mean ES\_MIN\_MEM, not EX\_MIN\_MEM.

you should set ES\_MIN\_MEM to be the same as ES\_MAX\_MEM, for mlockall to  
properly lock all the required memory

I think the problem is that a micro instance is just too small.

MIN/MAX\_MEM refers to the heap size, not the total memory that ES uses.  
The heap is usually the thing that can grow most, but the other memory  
usage is significant, when you have so little memory to spare.

I think that ES is just running out of memory - I'd highly recommend  
using a bigger instance

clint

---

<div class="post-metadata">

**Author:** ![Rio](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rio/32/2728_2.png) [@Rio](https://discuss.elastic.co/u/Rio)\
**Post date:** [September 28, 2011, 7:33pm UTC](https://discuss.elastic.co/t/elasticsearch-on-ec2-trouble-with-the-tutorial/5471/3 "2011-09-28T19:33:34Z")

</div>

Yep. You were right, the instance was just too small.

Thanks!

-Mario

---

<div class="post-metadata">

**Author:** ![Karussell1](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@Karussell1](https://discuss.elastic.co/u/Karussell1)\
**Post date:** [September 29, 2011, 7:23am UTC](https://discuss.elastic.co/t/elasticsearch-on-ec2-trouble-with-the-tutorial/5471/4 "2011-09-29T07:23:49Z")

</div>

No, I don't think it is too small - it really depends on the amount of  
data.

Just decrease the memory for MIN/MAX to 200 or 300MB and also decrease  
the permgen size to 50.

On 28 Sep., 21:33, Rio [rio...@gmail.com](mailto:rio...@gmail.com) wrote:

> Yep. You were right, the instance was just too small.
> 
> Thanks!
> 
> -Mario

---

<div class="post-metadata">

**Author:** ![Jesus\_Roncero](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jesus_roncero/32/2716_2.png) [@Jesus\_Roncero](https://discuss.elastic.co/u/Jesus_Roncero)\
**Post date:** [September 20, 2012, 1:31pm UTC](https://discuss.elastic.co/t/elasticsearch-on-ec2-trouble-with-the-tutorial/5471/5 "2012-09-20T13:31:32Z")

</div>

Hi,

I was also having difficulty with this trying to get it running (following  
the tutorial) it on a micro instance on amazon. It can be run on that but  
you have to reduce the memory to around 150 Mb (ES\_MAX\_MEM and ES\_MIN\_MEM).

To see if the OOM killer is running run dmesg and look for messages like:  
[7938.981497] Out of memory: Kill process 22527 (java) score 894 or  
sacrifice child

as the java process exits without any kind of message and/or error.

J.

On Thursday, 29 September 2011 08:23:49 UTC+1, Karussell wrote:

> No, I don't think it is too small - it really depends on the amount of  
> data.
> 
> Just decrease the memory for MIN/MAX to 200 or 300MB and also decrease  
> the permgen size to 50.
> 
> On 28 Sep., 21:33, Rio [rio...@gmail.com](mailto:rio...@gmail.com) wrote:
> 
> > Yep. You were right, the instance was just too small.
> > 
> > Thanks!
> > 
> > -Mario

--

---

<div class="post-metadata">

**Author:** ![Derry\_O\_Sullivan](https://avatars.discourse-cdn.com/v4/letter/d/7bcc69/32.png) [@Derry\_O\_Sullivan](https://discuss.elastic.co/u/Derry_O_Sullivan)\
**Post date:** [September 25, 2012, 7:30am UTC](https://discuss.elastic.co/t/elasticsearch-on-ec2-trouble-with-the-tutorial/5471/6 "2012-09-25T07:30:46Z")

</div>

HI,

We have also had problems with java processes on micro instances (not just  
ES), and it's a common problem. You can control the OOM though:

> **[Taming the OOM killer \[LWN.net\]](https://lwn.net/Articles/317814/)**
>
> Under desperately low memory conditions, the out-of-memory (OOM) killer
> kicks in and picks a process to kill using a set of heuristics which has
> evolved over time. This may be pretty annoying for users who may have
> wanted a different process to be...

Also worth noting that a small instance seems to behave a lot better than a  
micro (micro is just a burst usage instance) although it costs more (above  
free usage tier).

On Thursday, 20 September 2012 14:31:32 UTC+1, Jesús Roncero wrote:

> Hi,
> 
> I was also having difficulty with this trying to get it running (following  
> the tutorial) it on a micro instance on amazon. It can be run on that but  
> you have to reduce the memory to around 150 Mb (ES\_MAX\_MEM and ES\_MIN\_MEM).
> 
> To see if the OOM killer is running run dmesg and look for messages like:  
> [7938.981497] Out of memory: Kill process 22527 (java) score 894 or  
> sacrifice child
> 
> as the java process exits without any kind of message and/or error.
> 
> J.
> 
> On Thursday, 29 September 2011 08:23:49 UTC+1, Karussell wrote:
> 
> > No, I don't think it is too small - it really depends on the amount of  
> > data.
> > 
> > Just decrease the memory for MIN/MAX to 200 or 300MB and also decrease  
> > the permgen size to 50.
> > 
> > On 28 Sep., 21:33, Rio [rio...@gmail.com](mailto:rio...@gmail.com) wrote:
> > 
> > > Yep. You were right, the instance was just too small.
> > > 
> > > Thanks!
> > > 
> > > -Mario

--

---

<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, 3:11am UTC](https://discuss.elastic.co/t/elasticsearch-on-ec2-trouble-with-the-tutorial/5471/7 "2017-07-06T03:11:35Z")

</div>


