ElasticSearch插件:“无法解析配置路径”错误

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ElasticSearch插件:“无法解析配置路径”错误相关的知识,希望对你有一定的参考价值。

我在debian jessie上安装elasticsearch 1.7.3。它使用默认配置文件并正常工作。但是,当我调用sudo /usr/share/elasticsearch/bin/plugin时,它返回一个错误:

Exception in thread "main" org.elasticsearch.env.FailedToResolveConfigException: Failed to resolve config path ["/usr/share/elasticsearch/config/elasticsearch.yml"], tried file path ["/usr/share/elasticsearch/config/elasticsearch.yml"], path file ["/usr/share/elasticsearch/config"/"/usr/share/elasticsearch/config/elasticsearch.yml"], and classpath
        at org.elasticsearch.env.Environment.resolveConfig(Environment.java:291)
        at org.elasticsearch.node.internal.InternalSettingsPreparer.prepareSettings(InternalSettingsPreparer.java:95)
        at org.elasticsearch.plugins.PluginManager.main(PluginManager.java:396)

文件/usr/share/elasticsearch/config/elasticsearch.yml存在,我可以用nano打开他。

有/ etc / default / elasticsearch文件:

# Start Elasticsearch automatically
START_DAEMON=true

# Run Elasticsearch as this user ID and group ID
#ES_USER=elasticsearch
#ES_GROUP=elasticsearch

# Heap Size (defaults to 256m min, 1g max)
#ES_HEAP_SIZE=2g

# Heap new generation
#ES_HEAP_NEWSIZE=

# max direct memory
#ES_DIRECT_SIZE=

# Maximum number of open files, defaults to 65535.
#MAX_OPEN_FILES=65535

# Maximum locked memory size. Set to "unlimited" if you use the
# bootstrap.mlockall option in elasticsearch.yml. You must also set
# ES_HEAP_SIZE.
#MAX_LOCKED_MEMORY=unlimited

# Maximum number of VMA (Virtual Memory Areas) a process can own
#MAX_MAP_COUNT=262144

# Elasticsearch log directory
#LOG_DIR=/var/log/elasticsearch

# Elasticsearch data directory
#DATA_DIR=/var/lib/elasticsearch

# Elasticsearch work directory
#WORK_DIR=/tmp/elasticsearch

# Elasticsearch configuration directory
#CONF_DIR=/etc/elasticsearch

# Elasticsearch configuration file (elasticsearch.yml)
#CONF_FILE=/etc/elasticsearch/elasticsearch.yml

# Additional Java OPTS
#ES_JAVA_OPTS=

# Configure restart on package upgrade (true, every other setting will lead to not restarting)
#RESTART_ON_UPGRADE=true

/var/log/elasticsearch/elasticsearch.log/var/log/elasticsearch/elasticsearch.error文件中没有记录。

有谁知道为什么会失败?

答案

这不是问题的决心。但我解决了我的问题。

/usr/share/elasticsearch/bin/plugin中的脚本生成bash-command并运行它。我编辑了这个文件。它由echo打印此命令而不是运行它。我复制了这个命令并从丛林终端运行它。它运行正常。

我不知道为什么,但它的工作。可能对某人有帮助。

另一答案

我也遇到了同样的问题 - 2016年9月。原来,这个问题出现在旧版本的弹性搜索(即1.7.3)中,它位于Ubuntu的回购中。使用当前的(无论如何推荐),你不应该得到这个错误。

要安装当前版本(编写本文,版本为2.4),请按照these steps进行操作:

wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

echo "deb https://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list

sudo apt-get update && sudo apt-get install elasticsearch
另一答案

这些变化为我解决了这个问题:

--- /usr/share/elasticsearch/bin/plugin 2015-12-24 05:14:52.000000000 +0000
+++ /usr/share/elasticsearch/bin/pluginfix  2018-04-21 22:54:49.547134959 +0000
@@ -79,7 +79,7 @@
       properties="$properties "$var"="$1""
       ;;
     *)
-      args="$args "$1""
+      args="$args $1"
   esac
   shift
 done
@@ -90,7 +90,7 @@
     *-Des.default.path.conf=*|*-Des.path.conf=*)
     ;;
     *)
-      properties="$properties -Des.default.path.conf="$CONF_DIR""
+      properties="$properties -Des.default.path.conf=$CONF_DIR"
     ;;
   esac
 fi
@@ -100,11 +100,11 @@
     *-Des.default.config=*|*-Des.config=*)
     ;;
     *)
-      properties="$properties -Des.default.config="$CONF_FILE""
+      properties="$properties -Des.default.config=$CONF_FILE"
     ;;
   esac
 fi

 export HOSTNAME=`hostname -s`

-exec "$JAVA" $JAVA_OPTS $ES_JAVA_OPTS -Xmx64m -Xms16m -Delasticsearch -Des.path.home=""$ES_HOME"" $properties -cp ""$ES_CLASSPATH"" org.elasticsearch.plugins.PluginManager $args
+exec "$JAVA" $JAVA_OPTS $ES_JAVA_OPTS -Xmx64m -Xms16m -Delasticsearch -Des.path.home="$ES_HOME" $properties -cp "$ES_CLASSPATH" org.elasticsearch.plugins.PluginManager $args

Pikaev Viktor发布的解决方法基本上应用了相同的修复方法。通过复制粘贴将由脚本执行的命令的操作,shell将删除一级引号对。

这个bug也被报道了 Ubuntu的 Debian(请参阅https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=807596)但已被标记为无法解决,因为:

...包弹性搜索刚从Debian存档中删除不稳定...

截至2018年3月11日。

另一答案

尝试这一步[为我工作]:1。运行elasticsearch 2.检查ps aux | grep弹性体 你会得到类似的东西 elastic+ 12723 4.3 25.7 4623016 261176 ? Sl 13:27 0:22 /usr/lib/jvm/java-8-openjdk-amd64/bin/java -Xms256m -Xmx1g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC -Dfile.encoding=UTF-8 -Delasticsearch -Des.pidfile=/var/run/elasticsearch.pid -Des.path.home=/usr/share/elasticsearch -cp :/usr/share/java/lucene-replicator-4.10.4.jar:/usr/share/java/lucene-facet-4.10.4.jar:/usr/share/java/lucene-analyzers-morfologik-4.10.4.jar:/usr/share/java/lucene-analyzers-kuromoji-4.10.4.jar:/usr/share/java/lucene-join-4.10.4.jar:/usr/share/java/lucene-suggest-4.10.4.jar:/usr/share/java/lucene-core-4.10.4.jar:/usr/share/java/log4j-1.2-1.2.17.jar:/usr/share/java/jts.jar:/usr/share/java/lucene-expressions-4.10.4.jar:/usr/share/java/spatial4j-0.4.1.jar:/usr/share/java/lucene-highlighter-4.10.4.jar:/usr/share/java/sigar.jar:/usr/share/java/lucene-memory-4.10.4.jar:/usr/share/java/lucene-analyzers-icu-4.10.4.jar:/usr/share/java/lucene-misc-4.10.4.jar:/usr/share/java/lucene-analyzers-smartcn-4.10.4.jar:/usr/share/java/lucene-benchmark-4.10.4.jar:/usr/share/java/lucene-analyzers-phonetic-4.10.4.jar:/usr/share/java/lucene-analyzers-uima-4.10.4.jar:/usr/share/java/lucene-sandbox-4.10.4.jar:/usr/share/java/lucene-classification-4.10.4.jar:/usr/share/java/elasticsearch-1.7.3.jar:/usr/share/java/groovy-all-2.x.jar:/usr/share/java/lucene-test-framework-4.10.4.jar:/usr/share/java/lucene-codecs-4.10.4.jar:/usr/share/java/lucene-queryparser-4.10.4.jar:/usr/share/java/apache-log4j-extras-1.2.17.jar:/usr/share/java/jna.jar:/usr/share/java/lucene-spatial-4.10.4.jar:/usr/share/java/lucene-queries-4.10.4.jar:/usr/share/java/lucene-analyzers-stempel-4.10.4.jar:/usr/share/java/lucene-analyzers-common-4.10.4.jar:/usr/share/java/lucene-demo-4.10.4.jar:/usr/share/java/lucene-grouping-4.10.4.jar: -Des.default.config=/etc/elasticsearch/elasticsearch.yml -Des.default.path.home=/usr/share/elasticsearch -Des.default.path.logs=/var/log/elasticsearch -Des.default.path.data=/var/lib/elasticsearch -Des.default.path.work=/tmp/elasticsearch -Des.default.path.conf=/etc/elasticsearch org.elasticsearch.bootstrap.Elasticsearch 4.现在使用/usr/lib/jvm/java-8-openjdk-amd64/bin/java -Xms256m -Xmx1g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC -Dfile.encoding=UTF-8 -Delasticsearch -Des.pidfile=/var/run/elasticsearch.pid -Des.path.home=/usr/share/elasticsearch -cp :/usr/share/java/lucene-replicator-4.10.4.jar:/usr/share/java/lucene-facet-4.10.4.jar:/usr/share/java/lucene-analyzers-morfologik-4.10.4.jar:/usr/share/java/lucene-analyzers-kuromoji-4.10.4.jar:/usr/share/java/lucene-join-4.10.4.jar:/usr/share/java/lucene-suggest-4.10.4.jar:/usr/share/java/lucene-core-4.10.4.jar:/usr/share/java/log4j-1.2-1.2.17.jar:/usr/share/java/jts.jar:/usr/share/java/lucene-expressions-4.10.4.jar:/usr/share/java/spatial4j-0.4.1.jar:/usr/share/java/lucene-highlighter-4.10.4.jar:/usr/share/java/sigar.jar:/usr/share/java/lucene-memory-4.10.4.jar:/usr/share/java/lucene-analyzers-icu-4.10.4.jar:/usr/share/java/lucene-misc-4.10.4.jar:/usr/share/java/lucene-analyzers-smartcn-4.10.4.jar:/usr/share/java/lucene-benchmark-4.10.4.jar:/usr/share/java/lucene-analyzers-phonetic-4.10.4.jar:/usr/share/java/lucene-analyzers-uima-4.10.4.jar:/usr/share/java/lucene-sandbox-4.10.4.jar:/usr/share/java/lucene-classification-4.10.4.jar:/usr/share/java/elasticsearch-1.7.3.jar:/usr/share/java/groovy-all-2.x.jar:/usr/share/java/lucene-test-framework-4.10.4.jar:/usr/share/java/lucene-codecs-4.10.4.jar:/usr/share/java/lucene-queryparser-4.10.4.jar:/usr/share/java/apache-log4j-extras-1.2.17.jar:/usr/share/java/jna.jar:/usr/share/java/lucene-spatial-4.10.4.jar:/usr/share/java/lucene-queries-4.10.4.jar:/usr/share/java/lucene-analyzers-stempel-4.10.4.jar:/usr/share/java/lucene-analyzers-common-4.10.4.jar:/usr/share/java/lucene-demo-4.10.4.jar:/usr/share/java/lucene-grouping-4.10.4.jar: -Des.default.config=/etc/elasticsearch/elasticsearch.yml -Des.default.path.home=/usr/share/elasticsearch -Des.default.path.logs=/var/log/elasticsearch -Des.default.path.data=/var/lib/elasticsearch -Des.default.path.work=/tmp/elasticsearch -Des.default.path.conf=/etc/elasticsearch as command and do(例如):$ command org.elasticsearch.plugins.PluginManager -i elasticsearch / elasticsearch-analysis-stempel 或检查帮助$ command org.elasticsearch.plugins.PluginManager -h

以上是关于ElasticSearch插件:“无法解析配置路径”错误的主要内容,如果未能解决你的问题,请参考以下文章

Elasticsearch之插件扩展

Elasticsearch常用插件

elasticsearch 浏览器插件

ElasticSearch elasticsearch-head插件安装

Elasticsearch7.8.0版本入门——elasticsearch-head插件的安装(win10环境)

ElasticSearch 插件