On April 27, 2024, our Sign-in and Create Account options will be unavailable from 9am-12pm ET. During this maintenance window, developer account access and free trial registration will be unavailable.

Migrating to Zookeeper in Linux - assuming you have JAVA_HOME set

I am setting up a new install of 16.4.1 on Linux and got to the part where I am supposed to install Zookeeper on the Search server to support SOLR. The instructions are simple enough, but the silly thing wouldn't start. It says it started but it didn't stay started. The process wasn't running. Looking at the log that isn't named log (it's named 'out'), it said it couldn't find "java". Scanning the shell script I could see it had a $JAVA variable assigned to point to the Java instance but I couldn't see where that variable was defined. I figured it was looking for a JAVA_HOME, but I didn't have one defined. Looking further I saw that JAVA_HOME is deprecated after Java 1.6 and we're running 1.8. Analyzing the script further, it appears to be using a sort of properties file named zkEnv.sh. This is where the $JAVA variable is being defined:

if [ "$JAVA_HOME" != "" ]; then
JAVA="$JAVA_HOME/bin/java"
else
JAVA=java
fi

As you can see, it's making some bold assumptions. Now maybe everyone else's Linux setups are preconfigured for Java in this way, but ours is not. Our root user does not have JAVA_HOME preset as an environment variable. And the PATH variable doesn't have any path pointing to a Java executable by default - our Java structure is on a separate storage mount and holds several versions of Java. To resolve this issue I had to modify the zkEnv.sh file to hardcode it to point to the JDK version most appropriate for this application. Once I did that, Zookeeper started successfully.

Based on there being no reference to anyone else complaining about this anywhere, I assume maybe I'm the only one who has ever had this issue and everyone else has their JAVA_HOME env variable set to some JDK 1.6 version. This is just for anyone who might have the bad fortune of finding themselves in my situation and didn't.