ccri / cloud-local

Install script for a local 1 node cloud...no excuses folks
17 stars 5 forks source link

Issue when starting hbase: JAVA_HOME not set #75

Open JB-data opened 4 years ago

JB-data commented 4 years ago

When I run the bin/cloud-local.sh init script , I am asked to login to my own machine (which serves as the hbase master) and provide the password when he complains about JAVA_HOME not set:

Starting hbase...
starting master, logging to /home/user/Documents/cloud-local/hbase-1.3.1/logs/hbase-user-master-ds-gpu11.out
OpenJDK 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
jb@ds-gpu11's password: 
ds-gpu11: +======================================================================+
ds-gpu11: |                    Error: JAVA_HOME is not set                       |
ds-gpu11: +----------------------------------------------------------------------+
ds-gpu11: | Please download the latest Sun JDK from the Sun Java web site        |
ds-gpu11: |     > http://www.oracle.com/technetwork/java/javase/downloads        |
ds-gpu11: |                                                                      |
ds-gpu11: | HBase requires Java 1.7 or later.                                    |
ds-gpu11: +======================================================================+

On my machine(the one used as hbase master), a proper version of java is installed and JAVA_HOME is not empty:

(base) jb@ds-gpu11:~/Documents/cloud-local$ java --version
openjdk 11.0.8 2020-07-14
OpenJDK Runtime Environment (build 11.0.8+10-post-Ubuntu-0ubuntu118.04.1)
OpenJDK 64-Bit Server VM (build 11.0.8+10-post-Ubuntu-0ubuntu118.04.1, mixed mode, sharing)
(base) jb@ds-gpu11:~/Documents/cloud-local$ echo $JAVA_HOME
/usr/lib/jvm/java-8-openjdk-amd64

so it is not clear to me why I get this error.

The error comes from /cloud-local/hbase-1.3.1/bin/hbase-config.sh where there is a check if JAVA_HOME is defined. I believe that in cloud-local/hbase-1.3.1/conf/hbase-env.sh folder JAVA_HOME can be set (like described here: https://hbase.apache.org/book.html#quickstart in 2.2.3), but this file is overwritten every time you run the cloud-local.sh init command, so I dont see how I can specify this. If I copy the exact same part of the script where it fails, and run it directly on my machine, it does not fail as JAVA_HOME is indeed recognized.

Any clue how I can specify JAVA_HOME variable correctly? Thanks!!

Extra info: I believe these are all the scripts that call each other: 1)script to initiate the cloud environment on local node /cloud-local/bincloud-local.sh init --> 2)calls script to start hbase /cloud-local/hbase-1.3.1/bin/start-hbase.sh --> 3)calls script to start daemon: "$bin"/hbase-daemon.sh --config "${HBASE_CONF_DIR}" start master $@ 4)daemon is started: ~/Documents/cloud-local/hbase-1.3.1/bin/hbase-daemon.sh 5)From /cloud-local/hbase-1.3.1/bin/hbase-config.sh there is a check if JAVA_HOME is defined that fails .

JB-data commented 4 years ago

I just found how to fix this: in /cloud-local/hbase-1.3.1/conf/hbase-env.sh add the path to JAVA_HOME for java 8: export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 then run bin/cloud-local init again and if passed the check for JAVA_HOME .