搭建好了hadoop环境后,namenode、datanode看着都是正常的。但是当点到browser the file system时,结果报错了,报错的内容是“Failed to retrieve data from /webhdfs/v1/?op=LISTSTATUS: Server Error“.
在解决这个问题上,我走了一些弯路。比如修改hadoop的core-site.xml,hdfs-site.xml。设置文件权限,修改文件目录等。但都不起作用。
后来我看了下hadoop官网的介绍,它支持的jdk的最新版本是11。而我的足迹的jdk的版本是18。
后来我从oracel的官网上下载了jdk的11版本,上传到服务器上,解压缩,重新配置JAVA_HOME环境变量。
修改bashrc文件:
export JAVA_HOME=/root/jdk-11.0.16.1
export PATH=$PATH:$JAVA_HOME/bin:.
然后将hadoop重新启动后,问题解决了。
这个jdk版本的大坑,希望学习大数据的同学跳过这个大坑。
Hadoop Java Versions
Skip to end of metadata
Created by Akira Ajisaka, last modified on Oct 19, 2020Go to start of metadata
Supported Java Versions
Apache Hadoop 3.3 and upper supports Java 8 and Java 11 (runtime only)
Please compile Hadoop with Java 8. Compiling Hadoop with Java 11 is not supported: HADOOP-16795 - Java 11 compile support OPEN
Apache Hadoop from 3.0.x to 3.2.x now supports only Java 8
Apache Hadoop from 2.7.x to 2.10.x support both Java 7 and 8
Supported JDKs/JVMs
Now Apache Hadoop community is using OpenJDK for the build/test/release environment, and that's why OpenJDK should be supported in the community.
https://github.com/apache/hadoop/blob/rel/release-3.2.1/dev-support/docker/Dockerfile#L92
Other jdks/jvms should work well. If you find they don't work as expected, please file a JIRA.