Error : Could not find or load main class fs

*爱你&永不变心* 提交于 2021-02-07 04:27:33

问题


I am trying create a directory with the below commands:

  1. hadoop fs -mkdir sample

  2. hadoop fs -mkdir /user/cloudera/sample1

Either way i receive the error:

Could not find or load main class fs

How do I resolve this issue?


回答1:


These two Stack Overflow posts illustrate that the hadoop fs and hadoop dfs commands are deprecated and have been for some time.

Ideally you should be using hdfs dfs instead. As Ramya B states, you need to become the hdfs user in order to use this type of command and ensure that safe mode is turned off. If you have Ambari, you can easily access the NameNode UI to check that this isn't the case.

Usage:

hdfs dfs -mkdir [hdfs location]

I would assume that the reason you're getting an error is because hadoop fs is no longer a command you can use to execute filesystem changes on HDFS.




回答2:


First give sudo su - hdfs and give hadoop dfsadmin -safemode leave Then user can run the commands



来源:https://stackoverflow.com/questions/41982910/error-could-not-find-or-load-main-class-fs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!