0

After installing hadoop 2.7.7 in standalone mode on a Raspberry Pi on a clean Raspbian Stretch Lite (plus java version 1.8.0_65), I get the following error:

Error: JAVA_HOME is not set and could not be found.

This is despite me having this line in /etc/bash.bashrc:

export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")

printenv outputs the following:

...
JAVA_HOME=/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/
....

I see lots of similar questions, but the answers seem to be that either the export is commented out by mistake, or to put this in hadoop-env.sh - however I don't seem to have this file.

I am trying to follow the instructions here, and all is well, until:

Start, stop and list running services

1. $cd $HADOOP_HOME/sbin

2. $./start-dfs.sh

How can I fix this please ?

Joe King
  • 2,955
  • 7
  • 29
  • 43
  • Hadoop doesn't run very well on a Pi, by the way, given that the default heap spaces are about 1G each for the datanode, namenode, resourcemanager and nodemanager... If you just want HDFS, there's better options on the Pi for a DFS – OneCricketeer Aug 02 '18 at 04:45
  • @cricket_007 each Pi has 128GB of flash storage, and I have 5 of them so I thought it would be a nice little test bed to play with :) – Joe King Aug 02 '18 at 07:44
  • Storage won't help your heap space. That's all in RAM – OneCricketeer Aug 02 '18 at 14:20
  • @cricket_007 hopefully `HADOOP_HEAPSIZE=250` would help in `hadoop-env.sh` ? – Joe King Aug 04 '18 at 09:06

1 Answers1

3

Let's edit /etc/hadoop/hadoop-env.sh file and set JAVA_HOME for Hadoop. It is the path on which you didn't find hadoop-env.sh.

Open the file and find the line as bellow

export JAVA_HOME=/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/

If the line exists and is commented out, do uncomment. Otherwise, add the line into the file. Beware not

export JAVA_HOME=${JAVA_HOME}

If the file is still not found, maybe path is different. Try to search it using,

find / -iname 'hadoop-env.sh'