今天重新搭建了一个3节点的Hadoop集群,想着在上面测试一个MapReduce实例,然后就出现了以下错误:
[hadoop@master hadoop-2.6.0]$ hadoop -bash: hadoop: command not found
出现这个错误的原因是没有配置环境变量,操作过程如下。
vi /etc/profile //权限不够时再前面加上sudo
进入配置文件后,按照以下配置进行对比,没有的请写进去。
#hadoop export HADOOP_HOME=/opt/modules/hadoop-2.6.0 #java export JAVA_HOME=/opt/modules/jdk export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin
配置完成后执行下列命令更新配置
source /etc/profile
然后运行hadoop命令查看配置是否生效,内容如下。
[hadoop@master hadoop-2.6.0]$ hadoop Usage: hadoop [--config confdir] COMMAND where COMMAND is one of: fs run a generic filesystem user client version print the version jarrun a jar file checknative [-a|-h] check native hadoop and compression libraries availability distcp copy file or directories recursively archive -archiveName NAME -p * create a hadoop archive classpath prints the class path needed to get the credential interact with credential providers Hadoop jar and the required libraries daemonlog get/set the log level for each daemon trace view and modify Hadoop tracing settings or CLASSNAME run the class named CLASSNAME Most commands print help when invoked w/o parameters.
以上就是博主为大家介绍的这一板块的主要内容,这都是博主自己的学习过程,希望能给大家带来一定的指导作用,有用的还望大家点个支持,如果对你没用也望包涵,有错误烦请指出。如有期待可关注博主以第一时间获取更新哦,谢谢!
版权声明:本文为博主原创文章,未经博主允许不得转载。