(在Elasticsearch版本6.5.1上)
如何使用本地插件从源代码构建/运行Elasticsearch?
我尝试了以下命令来安装插件:./distribution/build/cluster/run\ node0/elasticsear-6.5.1-SNAPSHOT/bin/elasticsearch-plugin install file:/<path_to_plugin_zip>,这表明它成功地安装了插件。
但是,当我通过./gradlew run --debug-jvm运行elasticsearch时,它会在运行ES之前清除该目录的内容。
我之所以将插件安装到这个特定的目录中,是因为我在PluginsService.java文件中放置了一个调试器,并看到构造函数中的Path pluginsDirectory参数被设置为/Users/jreback/Desktop/elasticsearch/distribution/build/cluster/run node0/elasticsearch-6.5.1-SNAPSHOT/plugins。
那么,如何在本地ES版本上安装我的插件并运行ES,使插件代码在进程启动时不会被删除?首先要感谢大家!
发布于 2019-10-11 01:02:06
FWIW,我通过一些手动代码更改实现了这一点(可能有或者可能有更推荐的方法来实现这一点,但这对我有效)。
在ES签出中,我对server/src/main/java/org/elasticsearch/env/Environment.java进行了以下代码更改
pluginsFile = homeFile.resolve("plugins");替换为pluginsFile = Paths.get("<path to plugin directory"); (而且,您必须在该文件的顶部使用import java.nio.file.Paths )。上面列出的目录的目录结构应该如下所示:
- plugin parent directory (should whatever you put in the Environment.java file)
- plugin directory (name of the plugin)
- plugin-descriptor.properties file
- plugin jar file (generated from building the plugin in some prior step)然后,当您再次启动ES时,您应该会看到它加载了您刚刚添加到日志中的插件。
https://stackoverflow.com/questions/58228508
复制相似问题