gpt4 book ai didi

java - 如何从 Java 应用程序中运行 elasticsearch 5.1 服务器(不通过命令行)

转载 作者:行者123 更新时间:2023-11-30 06:55:51 25 4
gpt4 key购买 nike

在elasticsearch 1.x中,我曾经调用:

org.elasticsearch.bootstrap.Elasticsearch.main(args)

但是在 5.x 中,他们将 org.elasticsearch.bootstrap.Elasticsearch 类设为包私有(private)(默认),因此我无法再以简洁的方式从 java 代码运行 ES 服务器。有没有其他简洁的方法来做到这一点(与 Runtime exec 或 Apache Commons Exec 不同)?

谢谢!

最佳答案

你不能。不支持。

参见https://www.elastic.co/blog/elasticsearch-the-server

Embedded Elasticsearch not supported

Some users run Elasticsearch as embedded. We are not going to stop them from doing so, but we cannot support it. Embedding Elasticsearch bypasses the security manager, the Jar Hell checks, the bootstrap checks, and plugin loading. It is inherently unsafe and not recommended for production. For the sanity of our developers and support team, we cannot support users who disable all of the safety mechanisms which we have added for good reasons. For the same reason, we will not accept pull requests or make changes specifically to support the embedded use case

关于java - 如何从 Java 应用程序中运行 elasticsearch 5.1 服务器(不通过命令行),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41833511/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com