I have elasticsearch running 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 the ES_CLASSPATH var". ES_CLASSPATH is set as far as I can tell. Google shows a handful of results, but nothing working for me.
Any ideas about what might be going wrong when I try to launch elasticsearch? I'm using version 5.0.0, but attempts with previous versions are yielding the same error.
I was able to easily reproduce the issue. I tried just removing elasticsearch.in.sh script from the ES_HOME/bin directory and then tried running ./elasticsearch from ES_HOME/bin directory. I got,
You must set the ES_CLASSPATH var
elasticsearch.in.sh file contains this class path set-up. So please make sure you have elasticsearch.in.sh file in ES_HOME/bin directory.
According to ./elasticsearch script it looks for this elasticsearch.in.sh file in all the following places. So placing it in any of the following places would be fine.
/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"
Please note that ES_HOME is the base installation directory of elasticsearch.
Contents of the elasticsearch.in.sh file for your 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With