<大数据架构>类似NFSGateway的hadoop fuse挂载

时间:Dec. 5, 2016 分类:

目录:

fuse的软件包

[root@bogon yum.repos.d]# yum install -y fuse fuse-libs hadoop-hdfs-fuse

挂载hadoop-fuse

[root@bogon yum.repos.d]# mkdir /HDFS
[root@bogon yum.repos.d]# hadoop-fuse-dfs  dfs://192.168.0.230:8020 /HDFS -obig_writes
INFO /build-data/workspace/bigtop_crh_hadoop/build/hadoop/rpm/BUILD/hadoop-2.6.4-src/hadoop-hdfs-project/hadoop-hdfs/src/main/native/fuse-dfs/fuse_options.c:164 Adding FUSE arg /HDFS
[root@bogon yum.repos.d]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3        50G  8.5G   39G  19% /
tmpfs           1.9G   80K  1.9G   1% /dev/shm
/dev/sda1       477M   42M  411M  10% /boot
/dev/sda5        45G   53M   43G   1% /home
/dev/sr0        4.3G  4.3G     0 100% /media/NeoKylin Linux Advanced Server 6
fuse_dfs         56G  4.3G   52G   8% /HDFS
[root@bogon yum.repos.d]# ll /HDFS/
总用量 28
drwxrwxrwx 3 yarn   hadoop 4096 10月 13 2016 app-logs
drwxr-xr-x 3 hdfs   hdfs   4096 10月 13 2016 crh
drwxr-xr-x 3 mapred hdfs   4096 10月 13 2016 mapred
drwxrwxrwx 4 mapred hadoop 4096 10月 13 2016 mr-history
drwxr-xr-x 4 hdfs   hdfs   4096 10月 14 2016 test
drwxrwxrwx 4 hdfs   hdfs   4096 10月 13 2016 tmp
drwxr-xr-x 3 hdfs   hdfs   4096 10月 13 2016 user
[root@redoop ~]# hadoop fs -ls /
Found 7 items
drwxrwxrwx   - yarn   hadoop          0 2016-10-13 23:12 /app-logs
drwxr-xr-x   - hdfs   hdfs            0 2016-10-13 23:07 /crh
drwxr-xr-x   - mapred hdfs            0 2016-10-13 23:07 /mapred
drwxrwxrwx   - mapred hadoop          0 2016-10-13 23:09 /mr-history
drwxr-xr-x   - hdfs   hdfs            0 2016-10-14 04:10 /test
drwxrwxrwx   - hdfs   hdfs            0 2016-10-13 23:11 /tmp
drwxr-xr-x   - hdfs   hdfs            0 2016-10-13 23:06 /user

通过hadoop上传

[hdfs@redoop root]$ hadoop fs -put /etc/yum.repos.d/ambari.repo /
[hdfs@redoop root]$ hadoop fs -ls /
Found 10 items
-rw-r--r--   3 hdfs   hdfs          114 2016-10-14 13:25 /ambari.repo
drwxrwxrwx   - yarn   hadoop          0 2016-10-13 23:12 /app-logs
-rw-r--r--   3 hdfs   hdfs            0  2016-10-13 23:07 /crh
drwxr-xr-x   - mapred hdfs            0 2016-10-13 23:07 /mapred
drwxrwxrwx   - mapred hadoop          0 2016-10-13 23:09 /mr-history
drwxr-xr-x   - hdfs   hdfs            0 2016-10-14 04:10 /test
drwxrwxrwx   - hdfs   hdfs            0 2016-10-13 23:11 /tmp
drwxr-xr-x   - hdfs   hdfs            0 2016-10-13 23:06 /user

[hdfs@bogon yum.repos.d]$ ll /HDFS
总用量 28
-rw-r--r-- 1 hdfs   hdfs    114 10月 14 13:25 ambari.repo
drwxrwxrwx 3 yarn   hadoop 4096 10月 13 23:12 app-logs
drwxr-xr-x 3 hdfs   hdfs   4096 10月 13 23:07 crh
drwxr-xr-x 3 mapred hdfs   4096 10月 13 23:07 mapred
drwxrwxrwx 4 mapred hadoop 4096 10月 13 23:09 mr-history
drwxr-xr-x 4 hdfs   hdfs   4096 10月 14 04:10 test
drwxrwxrwx 4 hdfs   hdfs   4096 10月 13 23:11 tmp
drwxr-xr-x 3 hdfs   hdfs   4096 10月 13 23:06 user

通过fuse挂载上传

[hdfs@bogon yum.repos.d]$ touch /HDFS/a
[hdfs@bogon yum.repos.d]$ ll /HDFS
总用量 28
-rw-r--r-- 1 hdfs   hdfs      0 10月 14 13:24 a
-rw-r--r-- 1 hdfs   hdfs    114 10月 14 13:25 ambari.repo
drwxrwxrwx 3 yarn   hadoop 4096 10月 13 23:12 app-logs
drwxr-xr-x 3 hdfs   hdfs   4096 10月 13 23:07 crh
drwxr-xr-x 3 mapred hdfs   4096 10月 13 23:07 mapred
drwxrwxrwx 4 mapred hadoop 4096 10月 13 23:09 mr-history
drwxr-xr-x 4 hdfs   hdfs   4096 10月 14 04:10 test
drwxrwxrwx 4 hdfs   hdfs   4096 10月 13 23:11 tmp
drwxr-xr-x 3 hdfs   hdfs   4096 10月 13 23:06 user
[hdfs@redoop root]$ hadoop fs -ls /
Found 10 items
-rw-r--r--   3 hdfs   hdfs            0 2016-10-14 13:24 /a
-rw-r--r--   3 hdfs   hdfs          114 2016-10-14 13:25 /ambari.repo
drwxrwxrwx   - yarn   hadoop          0 2016-10-13 23:12 /app-logs
-rw-r--r--   3 hdfs   hdfs            0  2016-10-13 23:07 /crh
drwxr-xr-x   - mapred hdfs            0 2016-10-13 23:07 /mapred
drwxrwxrwx   - mapred hadoop          0 2016-10-13 23:09 /mr-history
drwxr-xr-x   - hdfs   hdfs            0 2016-10-14 04:10 /test
drwxrwxrwx   - hdfs   hdfs            0 2016-10-13 23:11 /tmp
drwxr-xr-x   - hdfs   hdfs            0 2016-10-13 23:06 /user