hadoop2.6.5安装报错:Error: Could not find or load main class org.apache.hadoop.hdfs.server.namenode.Name

centos6.5安装Hadoop2.6.5,在执行 hdfs namenode -format时报错如下:

Error: Could not find or load main class org.apache.hadoop.hdfs.server.namenode.NameNode

原因:找不到对应的类,也就是说找不到jar包。所以需要配置 HADOOP_COMMON_LIB_NATIVE_DIR
这个环境变量

解决方法:
在~/.bashrc中添加:

export HADOOP_INSTALL=$HADOOP_HOME
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export YARN_HOME=$HADOOP_HOME
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native

然后刷新,source ~/.bashrc,重新格式化

解决方法参考:
https://blog.csdn.net/Lnho2015/article/details/51120537
https://www.tutorialspoint.com/hadoop/hadoop_enviornment_setup.htm

你可能感兴趣的:(大数据)