Search code examples
linuxhadoophdfscloudera

How to transfer file from local disk to Cloudera Virtual Machine? (I've looked through SO and found nothing)


This is pretty trivial, so trivial that I haven't been able to find anything on here.

So, my task is quite simple. Take a simple .txt file and transfer it onto an hdfs directory in cloudera.

I've tried this:

enter image description here

but no luck. Any help or guidance would be much appreciated.


Solution

  • Assuming that you have already copied files to VM and you are logged into VM (linux), the command you should be using is:

    hdfs dfs -copyFromLocal <local-linux-path> <hdfs-path>
    

    If you don't have your home directory created on HDFS, then create it first using:

    hdfs dfs -mkdir -p /user/madhav/
    

    The path you are giving in the command you have shown looks wrong to me. It should look something like:

    hdfs dfs -copyFromLocal /home/madhav/file.txt /user/madhav/
    

    Then you can check your file on hdfs with:

    hdfs dfs -ls /user/madhav/