Created
July 14, 2015 23:25
-
-
Save jconwell/1af41535c5ecd2f4a9dd to your computer and use it in GitHub Desktop.
Remotly Debug ElasticSearch in IntelliJ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pretty simple once you know how. | |
Step 1: In IntelliJ, create a new remote debug configuration. Name it something ElasticSearchy. All of the default values should be fine. The only thing you need to change is the Host value. If ElasticSearch is gonna be running locally, just use "localhost", otherwise use the IP address of the remote machine ElasticSearch is gonna run on | |
Step 2: When starting ElasticSearch, just add a -D argument with the standard java remote debug values like so: | |
bin/elasticsearch -D "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005" | |
ElasticSearch will start and if suspend is set to 'y', it'll pause execution until you have attached the IntelliJ debugger. | |
Step 3: In IntilliJ, run the remote debug configuration you created in step 1. | |
At this point any breakpoints you have set in, say, an ElasticSearch plugin will get hit |
@elbarto93 , setting ES_JAVA_OPTS did not work because the value is getting set by groovy script, hence it is getting over written.
https://github.com/elastic/elasticsearch/blob/b3f3a4312b55acd02e9291d7ae231b397e275d0b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy#L627
i changed the port at this line and then from commandline ran ./gradlew run --debug-jvm, then the port was 5005 instead of 8000
Thanks
Nikita
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, needed to debug an elasticsearch plugin via IntelliJIDEA. (JDK 1.8, elasticsearch 5.4, Windows 10 x64)
I've managed to do it by adding
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
inside\elasticsearch-5.4.0\config\jvm.options
file. I don't know why the "ES_JAVA_OPTS" method didn't work for me.Thanks