You must set ES_CLASSPATH var

I have elasticsearch working locally just fine. Well, it's time to put it on my server. Whenever I try to run on the server, I get "You must set ES_CLASSPATH var". ES_CLASSPATH is set, as far as I can tell. Google shows some results, but nothing works for me.

Any ideas on what might be wrong when I try to run elasticsearch? I am using version 5.0.0, but trying with previous versions gives the same error.

+5
source share
2 answers

I could easily reproduce the problem. I tried just removing the elasticsearch.in.sh script from the ES_HOME / bin directory and then tried to run. / elasticsearch from the ES_HOME / bin directory. I got,

You must set the ES_CLASSPATH var

The elasticsearch.in.sh file contains this path setting for this class. Therefore, please make sure that you have the elasticsearch.in.sh file in the ES_HOME / bin directory.

In accordance with. / elasticsearch script it looks for this elasticsearch.in.sh file in all of the following places. Therefore, placing it in any of the following places would be nice.

/usr/share/elasticsearch/elasticsearch.in.sh
/usr/local/share/elasticsearch/elasticsearch.in.sh
/opt/elasticsearch/elasticsearch.in.sh 
~/.elasticsearch.in.sh
"$ES_HOME/bin/elasticsearch.in.sh"

Note that ES_HOME is the base installation directory for elasticsearch.

The contents of the elasticsearch.in.sh file for reference.

#!/bin/bash

# check in case a user was using this mechanism
if [ "x$ES_CLASSPATH" != "x" ]; then
    cat >&2 << EOF
Error: Don't modify the classpath with ES_CLASSPATH. Best is to add
additional elements via the plugin mechanism, or if code must really be
added to the main classpath, add jars to lib/ (unsupported).
EOF
    exit 1
fi

ES_CLASSPATH="$ES_HOME/lib/elasticsearch-5.0.0.jar:$ES_HOME/lib/*"

Note that it sets ES_CLASSPATH.

+3
source

, 32- Java 64- Windows

0

Source: https://habr.com/ru/post/1659211/


All Articles