参考文章:http://hadoop.apache.org/docs/r2.7.4/hadoop-archives/HadoopArchives.html
第一步:在/user目录下创建hadoop,zoo目录
创建 /user/hadoop/dir1, /user/hadoop/dir2
[root@hadoop hadoop-2.7.4]# hadoop fs -ls /user
Found 2 items
drwxr-xr-x - root supergroup 0 2017-09-24 14:27 /user/root
drwxr-xr-x - root supergroup 0 2017-09-24 13:01 /user/st
[root@hadoop hadoop-2.7.4]# hadoop fs -mkdir /user/hadoop
[root@hadoop hadoop-2.7.4]# hadoop fs -mkdir /user/hadoop/dir1
[root@hadoop hadoop-2.7.4]# hadoop fs -mkdir /user/hadoop/dir2
复制一些数据到dir1,dir2目录
[root@hadoop hadoop-2.7.4]# hadoop fs -cp /user/hadoop/input !$
hadoop fs -cp /user/hadoop/input /user/hadoop/dir2
[root@hadoop hadoop-2.7.4]# hadoop fs -cp /user/hadoop/input /user/hadoop/dir1
[root@hadoop hadoop-2.7.4]# hadoop fs -ls /user/hadoop/dir1
Found 1 items
drwxr-xr-x - root supergroup 0 2017-09-25 01:01 /user/hadoop/dir1/input
创建/user/zoo
[root@hadoop hadoop-2.7.4]# hadoop fs -mkdir /user/zoo
第二步:create archive
[root@hadoop hadoop-2.7.4]# hadoop archive -archiveName foo.har -p /user/hadoop -r 3 dir1 dir2 /user/zoo
......省略一堆输出
[root@hadoop hadoop-2.7.4]# hadoop fs -ls /user/zoo
Found 1 items
drwxr-xr-x - root supergroup 0 2017-09-25 01:03 /user/zoo/foo.har