标签:目的 padding function body 使用 pac pen 常用 home
一、Hadoop提供的Shell命令完成相同任务:
cd /home/hadoop/
touch test.txt
cat temp.txt
cd /usr/local/hadoop
./bin/hdfs dfs -put /home/hadoop/test.txt input
./bin/hdfs dfs -ls input
./bin/hdfs dfs -cat input/test.txt
rm -rf test.txt
ls
1
2
3
|
. / bin / hdfs dfs - get input / text.txt / home / hadoop . / bin / hdfs dfs - rm - r input / text.txt . / bin / hdfs dfs - ls input |
二、
if $(hdfs dfs -test -e test.txt);
then $(hdfs dfs -appendToFile local.txt test.txt);
else $(hdfs dfs -copyFromLocal -f local.txt test.txt);
fi
if $(hdfs dfs -test -e file:
then $(hdfs dfs -copyToLocal hello.txt ./test2.txt);
else $(hdfs dfs -copyToLocal hello.txt ./test.txt);
fi
hadoop fs -cat /usr/local/hadoop/test.txt
hadoop fs -ls -h /usr/local/hadoop/test.txt
hadoop fs -ls -R -h /usr/local/hadoop
if $(hadoop fs -test -d /usr/local/hadoop/test);
then $(hadoop fs -touchz /usr/local/hadoop/test/test1.txt);
else $(hadoop fs -mkdir -p /usr/local/hadoop/test && hadoop fs -touchz /usr/local/hadoop/test/test1.txt);
fi
hadoop fs -rmr /usr/local/hadoop/test
hadoop fs -appendToFile local.txt test.txt
hadoop fs -rm /usr/local/hadoop/test.txt
hadoop fs -rmr /usr/local/hadoop
hadoop fs -mv /usr/local/hadoop/test.txt /usr/local/hadoop/hadoop_tmp/test.txt
标签:目的 padding function body 使用 pac pen 常用 home
原文地址:https://www.cnblogs.com/xujinpei/p/8964757.html