#遇到问题的现象描述
在部署cdh6.3.2的hadoop3.0.0版本的linux系统服务器(不是在windows上远程连接,不是在windows上远程连接,重点说明)上运行flinkjob(1.13.6版本)报错。
#报错内容
java.io.FileNotFoundException: HADOOP_HOME and hadoop.home.dir are unset.
at org.apache.hadoop.util.Shell.checkHadoopHomeInner(Shell.java:469)
at org.apache.hadoop.util.Shell.checkHadoopHome(Shell.java:440)
at org.apache.hadoop.util.Shell.<clinit>(Shell.java:517)
at org.apache.hadoop.util.StringUtils.<clinit>(StringUtils.java:78)
at org.apache.hadoop.conf.Configuration.getBoolean(Configuration.java:1651)
at org.apache.hadoop.security.SecurityUtil.setConfigurationInternal(SecurityUtil.java:102)
at org.apache.hadoop.security.SecurityUtil.<clinit>(SecurityUtil.java:86)
at org.apache.hadoop.security.UserGroupInformation.initialize(UserGroupInformation.java:326)
at org.apache.hadoop.security.UserGroupInformation.ensureInitialized(UserGroupInformation.java:314)
at org.apache.hadoop.security.UserGroupInformation.doSubjectLogin(UserGroupInformation.java:1973)
at org.apache.hadoop.security.UserGroupInformation.createLoginUser(UserGroupInformation.java:743)
at org.apache.hadoop.security.UserGroupInformation.getLoginUser(UserGroupInformation.java:693)
at org.apache.hadoop.security.UserGroupInformation.getCurrentUser(UserGroupInformation.java:604)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.flink.runtime.util.EnvironmentInformation.getHadoopUser(EnvironmentInformation.java:215)
at org.apache.flink.runtime.util.EnvironmentInformation.logEnvironmentInfo(EnvironmentInformation.java:432)
at org.apache.flink.yarn.entrypoint.YarnJobClusterEntrypoint.main(YarnJobClusterEntrypoint.java:69)
#我的尝试解决方案
1)配置环境变量:
export HADOOP_HOME=/opt/cloudera/parcels/CDH
export PATH=$PATH:$HADOOP_HOME/bin
然后,重新打开终端或执行 source ~/.bashrc 或 source ~/.bash_profile 来使环境变量生效
2)在flinkjob启动命令加上一行参数:
-Dhadoop.home.dir=/opt/cloudera/parcels/CDH \
#操作环境
是在部署cdh6.3.2的hadoop3.0.0版本的linux系统服务器(不是在windows上远程连接,不是在windows上远程连接,重点说明)上运行flinkjob(1.13.6版本)报错;
#运行结果
通过上面的解决方案,还是不行,报一样的错。