putting a remote file into hadoop without copying it to local disk

前端 未结 4 407
猫巷女王i
猫巷女王i 2020-12-04 10:44

I am writing a shell script to put data into hadoop as soon as they are generated. I can ssh to my master node, copy the files to a folder over there and then put them into

相关标签:
4条回答
  • 2020-12-04 11:07

    (untested)

    Since the node where you create your data has access to internet, then perhaps you could install hadoop client node software, then add it to the cluster - after normal hadoop fs -put, then disconnect and remove your temporary node - the hadoop system should then automatically make replication of your files blocks inside your hadoop cluster

    0 讨论(0)
  • 2020-12-04 11:10

    The node where you have generated the data on, is this able to reach each of your cluster nodes (the name node and all the datanodes).

    If you do have data connectivity then you can just execute the hadoop fs -put command from the machine where the data is generated (assuming you have the hadoop binaries installed there too):

    #> hadoop fs -fs masternode:8020 -put test.bin hadoopFolderName/
    
    0 讨论(0)
  • 2020-12-04 11:30

    Try this (untested):

    cat test.txt | ssh username@masternode "hadoop dfs -put - hadoopFoldername/test.txt"
    

    I've used similar tricks to copy directories around:

    tar cf - . | ssh remote "(cd /destination && tar xvf -)"
    

    This sends the output of local-tar into the input of remote-tar.

    0 讨论(0)
  • 2020-12-04 11:34

    Hadoop provides a couple of REST interfaces. Check Hoop and WebHDFS. You should be able to copy the file without copying the file to the master using them from non-Hadoop environments.

    0 讨论(0)
提交回复
热议问题