performance-analyzer-agent allows setting a specific ES_HOME path as first argument and a JAVA_HOME path as second argument.
In fact, the installation in a non-systemd system suggests using this command for starting it:
sh /usr/share/elasticsearch/plugins/opendistro-performance-analyzer/pa_bin/performance-analyzer-agent /usr/share/elasticsearch -d
OpenDistro documentation specifies to install JDK in the system, however elasticsearch has its embedded JDK and is possible to use it without installing other JDK, so this command could be used for starting the agent:
sh /usr/share/elasticsearch/plugins/opendistro-performance-analyzer/pa_bin/performance-analyzer-agent /usr/share/elasticsearch /usr/share/elasticsearch/jdk -d
The problem is that even though the folder exist and is valid, it is not taken into account and displays the message:
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
This happens because inside the script, JAVA_HOME is defined as a variable but the agent is started using exec, and the variable is not available in its environment.
This works if JAVA_HOME is exported, in a similar way as JAVA_OPTS is exported in the same script.
performance-analyzer-agent
allows setting a specificES_HOME
path as first argument and aJAVA_HOME
path as second argument. In fact, the installation in a non-systemd system suggests using this command for starting it:sh /usr/share/elasticsearch/plugins/opendistro-performance-analyzer/pa_bin/performance-analyzer-agent /usr/share/elasticsearch -d
OpenDistro documentation specifies to install JDK in the system, however elasticsearch has its embedded JDK and is possible to use it without installing other JDK, so this command could be used for starting the agent:
sh /usr/share/elasticsearch/plugins/opendistro-performance-analyzer/pa_bin/performance-analyzer-agent /usr/share/elasticsearch /usr/share/elasticsearch/jdk -d
The problem is that even though the folder exist and is valid, it is not taken into account and displays the message:
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
This happens because inside the script,
JAVA_HOME
is defined as a variable but the agent is started usingexec
, and the variable is not available in its environment.This works if
JAVA_HOME
is exported, in a similar way asJAVA_OPTS
is exported in the same script.