将文本从命令行写入Hadoop

时间:2015-06-29 02:50:51

标签: file shell unix hadoop hdfs

是否可以将命令行中的文本写入Hadoop?

尝试执行与unix write / append to file命令类似的操作。

d:\ > function f([ScriptBlock]$s)
{
    1..10 | & $s
}
f { Write-Host mm }
mm

在Hadoop土地上,我希望这可以工作,但命令却没有。

echo "hello world" > hello_world.txt

1 个答案:

答案 0 :(得分:23)

Hadoop文档状态appendToFileput可以读取stdin

echo "hello world" | hadoop fs -appendToFile - /dir/hadoop/hello_world.txt

echo "hello world" | hadoop fs -put - /dir/hadoop/hello_world.txt

相关问题