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

前端 未结 4 419
猫巷女王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条回答
  •  旧时难觅i
    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.

提交回复
热议问题