hadoop安装后运行hadoop version 报找不到命令

hadoop安装后运行hadoop version 报找不到命令
[root@localhost devlops]# hadoop version
ERROR: JAVA_HOME is not set and could not be found.

原因:需要配置环境变量,并且设置java_home的路径:
1、编辑/etc/profile
JAVA_HOME=/opt/devlops/jdk8
export HADOOP_HOME=/opt/devlops/hadoop
export PATH= P A T H : PATH: PATH:JAVA_HOME/bin: H A D O O P H O M E / b i n : HADOOP_HOME/bin: HADOOPHOME/bin:HADOOP_HOME/sbin

保存后执行:source /etc/profile

2 、编辑hadoop-env.sh
export JAVA_HOME=/opt/devlops/jdk8

重新输入:
[root@localhost hadoop]# hadoop version
Hadoop 3.3.1
Source code repository https://github.com/apache/hadoop.git -r a3b9c37a397ad4188041dd80621bdeefc46885f2
Compiled by ubuntu on 2021-06-15T10:51Z
Compiled with protoc 3.7.1
From source with checksum 88a4ddb2299aca054416d6b7f81ca55
This command was run using /opt/devlops/hadoop/share/hadoop/common/hadoop-common-3.3.1.jar

你可能感兴趣的:(笔记,hadoop,apache,big,data)