hadoop fs -put command hadoop fs -put command hadoop hadoop

hadoop fs -put command


As user hdfs, do you have access rights to /root/ (in your local hdd)?. Usually you don't.You must copy file1.txt to a place where local hdfs user has read rights before trying to copy it to HDFS.

Try:

cp /root/MyHadoop/file1.txt /tmpchown hdfs:hdfs /tmp/file1.txt# older versions of Hadoopsudo -u hdfs hadoop fs -put /tmp/file1.txt /# newer versions of Hadoopsudo -u hdfs hdfs dfs -put /tmp/file1.txt /

--- edit:

Take a look at the cleaner roman-nikitchenko's answer bellow.


I had the same situation and here is my solution:

 HADOOP_USER_NAME=hdfs hdfs fs -put /root/MyHadoop/file1.txt /

Advantages:

  1. You don't need sudo.
  2. You don't need actually appropriate local user 'hdfs' at all.
  3. You don't need to copy anything or change permissions because of previous points.


try to create a dir in the HDFS by usig: $ hadoop fs -mkdir your_dirand then put it into it $ hadoop fs -put /root/MyHadoop/file1.txt your_dir