为什么要给小文件archive
未完成。。。。
commond:
hadoop archive -123.har name -p [-r ] *
将一个目录作为整个进行archive
hadoop archive -archiveName 123.har -p /test/archive -r 3 /test/
Unarchive
按顺序unarchive
hdfs dfs -cp har:///user/zoo/foo.har/dir1 hdfs:/user/zoo/newdir
并行unarchive
hadoop distcp har:///user/zoo/foo.har/dir1 hdfs:/user/zoo/newdir
查看归档文件:
hdfs dfs -ls -R har:///user/zoo/foo.har/
hdfs dfs -ls har:///user/zoo/foo.har
删除:hadoop fs -rmr user/zoo/foo.har
实例:
archive:hadoop archive -archiveName 123.har -p /test/archive -r 3 1.txt 2.txt 3.txt /test
查看:
hdfs dfs -ls -R har:///test/123.har
hdfs dfs -ls har:///test/123.har
删除后再次archive:
hadoop archive -archiveName foo.har -p /user/hadoop 1.txt 2.txt /user/zoo
hadoop archive -archiveName 123.har -p /test/ 1.txt 2.txt /test/
-rw-r--r-- 3 root supergroup 4 2019-05-13 01:29 har:///test/123.har/1.txt
-rw-r--r-- 3 root supergroup 4 2019-05-13 01:29 har:///test/123.har/2.txt
删除后再次archive:
hadoop archive -archiveName 123.har -p /test/ archive/1.txt archive/2.txt /test
再次查看:hdfs dfs -ls har:///test/123.har
-rw-r--r-- 3 root supergroup 4 2019-05-13 01:29 har:///test/123.har/archive/1.txt
-rw-r--r-- 3 root supergroup 4 2019-05-13 01:29 har:///test/123.har/archive/2.txt
查阅官网:http://hadoop.apache.org/docs/stable/hadoop-archives/HadoopArchives.html