简体   繁体   English

如何在IntelliJ IDEA中设置和运行/调试ElasticSearch

[英]How can I setup and run/debug ElasticSearch in IntelliJ IDEA

I am trying to learn how ES works however I haven't been able to run it from an IDE. 我正在尝试学习ES是如何工作的,但是我无法从IDE运行它。 I want to run the 2.3.3 build which still uses Maven as its build system but keep getting errors. 我想运行仍然使用Maven作为其构建系统的2.3.3版本,但不断出现错误。 Can someone tell me how I can do this in IDEA after I download the repository in detail ie. 在我详细下载存储库之后,有人可以告诉我如何在IDEA中执行此操作。 the configuration etc. 配置等

I downloaded the repository from github, then I imported the project into intellij and used the following configurations: 我从github下载了存储库,然后将项目导入intellij并使用了以下配置:

Main class: org.elasticsearch.bootstrap.Elasticsearch 主类:org.elasticsearch.bootstrap.Elasticsearch

Vm options: Vm选项:

-Xms256m
-Xmx1g
-Xss256k
-Djava.awt.headless=true
-XX:+UseParNewGC
-XX:+UseConcMarkSweepGC
-XX:CMSInitiatingOccupancyFraction=75
-XX:+UseCMSInitiatingOccupancyOnly
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=logs/heapdump.hprof
-Delasticsearch
-Des.foreground=yes
-Djava.library.path=lib/sigar
-ea
-Des.config=C:\elasticsearch-2.3.3\core\src\test\resources\config\elasticsearch.yaml>/elasticsearch.yml
-Des.logger.level=DEBUG
-Des.path.home=C:\elasticsearch-2.3.3

working directory: ES directory 工作目录:ES目录

environment variable: ES_TEST_LOCAL=true 环境变量:ES_TEST_LOCAL = true

use classpath of module: elasticsearch(1)(org.elasticsearch) 使用模块的类路径:elasticsearch(1)(org.elasticsearch)

and then I get the following errors when i try to run: 然后当我尝试运行时出现以下错误:

error 错误

For 5.x - From command line: 对于5.x - 从命令行:

> gradle run --debug-jvm
Running elasticsearch in debug mode, suspending until connected on port 8000
[elasticsearch] Listening for transport dt_socket at address: 8000

From Intellij, create a Remote debug configuration and set the port to 8000. 从Intellij创建远程调试配置并将端口设置为8000。 在此输入图像描述

Pre-requisites: 先决条件:

  1. Build the root project : mvn clean package -DskipTests (or execute run.sh) 构建根项目:mvn clean package -DskipTests(或执行run.sh)
  2. copy ./distribution/src/main/resources/config to ./core/. 将./distribution/src/main/resources/config复制到./core/。

Create a Run/Debug configuration as follows: 创建运行/调试配置,如下所示:

Main Class: org.elasticsearch.bootstrap.Elasticsearch   
VM Options: -Des.path.home=/code/elasticsearch/core   
Program Arguments: start   
Classpath of Module : [select the core project]   

After downloading Elasticsearch from github, in the top level directory there is file called CONTRIBUTING.md which describes how to configure your IDE, and there is also a file called TESTING.asciidoc which describes how to debug. 从github下载Elasticsearch后,在顶级目录中有一个名为CONTRIBUTING.md的文件,它描述了如何配置IDE,还有一个名为TESTING.asciidoc的文件,它描述了如何调试。

Based on the instructions contained in those text files, I have written a blog post that gives step-by-step instructions on how to configure IntelliJ IDEA to debug Elasticsearch and Lucene. 根据这些文本文件中包含的说明,我写了一篇博客文章,提供了有关如何配置IntelliJ IDEA以调试Elasticsearch和Lucene的分步说明。

https://alexmarquardt.com/2019/02/02/debugging-elasticsearch-and-lucene-with-intellij-idea/ https://alexmarquardt.com/2019/02/02/debugging-elasticsearch-and-lucene-with-intellij-idea/

Disclaimer: I am a consulting engineer at Elasticsearch 免责声明:我是Elasticsearch的咨询工程师

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM