# Start elasticsearch with debug option

**URL:** <https://discuss.elastic.co/t/start-elasticsearch-with-debug-option/56600>\
**Category:** Elasticsearch\
**Created:** [July 28, 2016, 9:51am UTC](https://discuss.elastic.co/t/start-elasticsearch-with-debug-option/56600 "2016-07-28T09:51:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ttjslbz](https://avatars.discourse-cdn.com/v4/letter/t/73ab20/32.png) [@ttjslbz](https://discuss.elastic.co/u/ttjslbz)\
**Post date:** [July 28, 2016, 9:51am UTC](https://discuss.elastic.co/t/start-elasticsearch-with-debug-option/56600/1 "2016-07-28T09:51:59Z")

</div>

Hi everyone  
i just start my elasticsearch with the following command  
**bin/elasticsearch -D "-Xdebug -Xrunjdwp:transport=dt\_socket,server=y,suspend=y,address=5005"**

it starts successfully, by when i try to connect it with a eclipse, it shows connection refused.

Does any boy debug elasticsearch in this way?

Hopes your reply.

---

<div class="post-metadata">

**Author:** ![javanna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javanna/32/4698_2.png) [@javanna](https://discuss.elastic.co/u/javanna)\
**Post date:** [July 28, 2016, 11:06am UTC](https://discuss.elastic.co/t/start-elasticsearch-with-debug-option/56600/2 "2016-07-28T11:06:04Z")

</div>

We support remote debugging simply by checking out elasticsearch from github and running `gradle run --debug-jvm`. See [here](https://github.com/elastic/elasticsearch/blob/master/TESTING.asciidoc#debugging-from-an-ide).

I just tried that and it works for me, the port used is 8000. Gradle does all the work of configuring jvm arguments, you just have to get you IDE to connect to localhost:8000. This is convenient also to make sure that the code in your IDE is actually in sync with the code you are running, as you run and debug from the same directory.

As for passing the needed jvm arguments to the elasticsearch startup script like you are trying to do, I think it should be done by providing the ES\_JAVA\_OPTS environment variable instead (without -D).

---

<div class="post-metadata">

**Author:** ![ttjslbz](https://avatars.discourse-cdn.com/v4/letter/t/73ab20/32.png) [@ttjslbz](https://discuss.elastic.co/u/ttjslbz)\
**Post date:** [July 29, 2016, 2:39am UTC](https://discuss.elastic.co/t/start-elasticsearch-with-debug-option/56600/3 "2016-07-29T02:39:54Z")

</div>

Hi Luca  
I successfully debug it by eclipse. Thanks for you quickly reply.

---

<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 5, 2017, 10:31pm UTC](https://discuss.elastic.co/t/start-elasticsearch-with-debug-option/56600/4 "2017-07-05T22:31:55Z")

</div>


