When configuring Hadoop, there is no JDK found when you format Hadoop
I used Red Hat is 32-bit, no ready-made 32-bit, hit Java, found that the machine has Java, and found a bit of its location
Found jdk-1.6.0.
which Java
[email protected] hadoop-1.1.2]# which Java
/usr/bin/java
[Email protected] hadoop-1.1.2]# Ls/usr/bin/java
/usr/bin/java
[Email protected] hadoop-1.1.2]# ls-l/usr/bin/java
lrwxrwxrwx. 1 root root June 03:00/usr/bin/java-/etc/alternatives/java
[Email protected] hadoop-1.1.2]# ls-l/etc/alternatives/java
lrwxrwxrwx. 1 root root 03:00/etc/alternatives/java June-/usr/lib/jvm/jre-1.6.0-openjdk/bin/java (you can see that the file is link, is a chain Pick
[Email protected] hadoop-1.1.2]# ls-l /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
-rwxr-xr-x. 1 root root 36548 Oct 2011/usr/lib/jvm/jre-1.6.0-openjdk/bin/java
[Email protected] hadoop-1.1.2]# CD/USR/LIB/JVM/JRE-1.6.0-OPENJDK
[[email protected] jre-1.6.0-openjdk]# ls
Bin Lib
In this way, it can be temporarily concluded that/USR/LIB/JVM/JRE-1.6.0-OPENJDK
Root user change config file: vi/etc/profile
Find Export PATH USER LOGNAME MAIL HOSTNAME histsize Histcontrol
Write on the following:
Export JAVA_HOME=/USR/LIB/JVM/JRE-1.6.0-OPENJDK
Export path= $PATH: $JAVA _home/bin
Export classpath=.: $JAVA _home/lib/tools.jar: $JAVA _home/lib/dt.jar
: Wq Save Exit
With Echo $JAVA _home
In the format of:
[Email protected] jre-1.6.0-openjdk]# Hadoop Namenode-format
16/07/11 19:16:37 INFO Namenode. Namenode:startup_msg:
/************************************************************
Startup_msg:starting NameNode
Startup_msg:host = host2/192.168.8.202
Startup_msg:args = [-format]
Startup_msg:version = 1.1.2
Startup_msg:build = Https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.1-r 1440782; Compiled by ' Hortonfo ' on Thu Jan 02:03:24 UTC 2013
************************************************************/
16/07/11 19:16:38 INFO util. GSET:VM type = 32-bit
16/07/11 19:16:38 INFO util. gset:2% max memory = 17.77875 MB
16/07/11 19:16:38 INFO util. gset:capacity = 2^22 = 4194304 entries
16/07/11 19:16:38 INFO util. gset:recommended=4194304, actual=4194304
16/07/11 19:16:38 INFO Namenode. Fsnamesystem:fsowner=root
16/07/11 19:16:38 INFO Namenode. Fsnamesystem:supergroup=supergroup
16/07/11 19:16:38 INFO Namenode. Fsnamesystem:ispermissionenabled=true
16/07/11 19:16:38 INFO Namenode. fsnamesystem:dfs.block.invalidate.limit=100
16/07/11 19:16:38 INFO Namenode. Fsnamesystem:isaccesstokenenabled=false accesskeyupdateinterval=0 min (s), Accesstokenlifetime=0 min (s)
16/07/11 19:16:38 INFO Namenode. namenode:caching file names occuring more than times
16/07/11 19:16:38 INFO Common. Storage:image file of size saved in 0 seconds.
16/07/11 19:16:38 INFO Namenode. Fseditlog:closing Edit log:position=4, editlog=/home/hadoop/dfs/filesystem/name/current/edits
16/07/11 19:16:38 INFO Namenode. Fseditlog:close success:truncate to 4, editlog=/home/hadoop/dfs/filesystem/name/current/edits
16/07/11 19:16:39 INFO Common. Storage:storage Directory/home/hadoop/dfs/filesystem/name has been successfully formatted.
16/07/11 19:16:39 INFO Namenode. Namenode:shutdown_msg:
/************************************************************
Shutdown_msg:shutting down NameNode at host2/192.168.8.202
************************************************************/
It can be formatted, but it doesn't work. Hadoop
star-all.sh
[Email protected] ~]$ start-all.sh
Starting Namenode, logging to/home/hadoop/hadoop-1.1.2/libexec/. /logs/hadoop-hadoop-namenode-host2.out
Host8:starting Datanode, logging to/home/hadoop/hadoop-1.1.2/libexec/. /logs/hadoop-hadoop-datanode-host8.out
Host2:starting Datanode, logging to/home/hadoop/hadoop-1.1.2/libexec/. /logs/hadoop-hadoop-datanode-host2.out
Host6:starting Datanode, logging to/home/hadoop/hadoop-1.1.2/libexec/. /logs/hadoop-hadoop-datanode-host6.out
Host8:Error:JAVA_HOME is not set.
Host2:Error:JAVA_HOME is not set.
Host6:Error:JAVA_HOME is not set.
Host2:starting Secondarynamenode, logging to/home/hadoop/hadoop-1.1.2/libexec/. /logs/hadoop-hadoop-secondarynamenode-host2.out
Host2:Error:JAVA_HOME is not set.
Jobtracker running as Process 5607. Stop it first.
Host6:starting Tasktracker, logging to/home/hadoop/hadoop-1.1.2/libexec/. /logs/hadoop-hadoop-tasktracker-host6.out
Host2:starting Tasktracker, logging to/home/hadoop/hadoop-1.1.2/libexec/. /logs/hadoop-hadoop-tasktracker-host2.out
Host8:starting Tasktracker, logging to/home/hadoop/hadoop-1.1.2/libexec/. /logs/hadoop-hadoop-tasktracker-host8.out
Host6:Error:JAVA_HOME is not set.
Host2:Error:JAVA_HOME is not set.
Host8:Error:JAVA_HOME is not set.
It seems that it is not possible to find the configuration of Dt.jar and Tools.jar is missing
Looks like we're going to have to download the official JDK.
Download "1.7.0_79"
Http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
After download, use TAR-ZXVF jdk-7u79-linux-i586.tar.gz to extract to the/OPT directory
Under Root user modification
Vim ~/.BASHRC
Export java_home=/opt/jdk1.7.0_79
Export JRE_HOME=${JAVA_HOME}/JRE
Export Classpath=.:${java_home}/lib:${jre_home}/lib
Export Path=${java_home}/bin: $PATH
SOURCE ~/.BASHRC
Update-alternatives--install/usr/bin/java Java/opt/jdk1.7.0_79/bin/java 300
Update-alternatives--install/usr/bin/javac Javac/opt/jdk1.7.0_79/bin/javac 300
Update-alternatives--install/usr/bin/jar Jar/opt/jdk1.7.0_79/bin/jar 300
Update-alternatives--config Java
Choose an option with jdk1.7.0_79
That'll do it.
View the JDK that comes with Linus, set Java_home