CDH 5 包含了FUSE (Filesystem in Userspace)接口到 HDFS. hadoop-hdfs-fuse 安装包让 HDFS 集群 做为Linux 的外部文件挂载到磁盘中.
安装FUSE
安装hadoop-hdfs-fuses在 Red Hat-compatible(CentOS)系统中:
$ sudo yum install hadoop-hdfs-fuse
报错:No package hadoop-hdfs-fuse available
解决办法:配置yum源,vi /etc/yum.repos.d/CentOS-Base.repo,将下边的配置加入到最后
[cloudera-cdh5]
# Packages for Cloudera's Distribution for Hadoop, Version 5, on RedHat or CentOS 6 x86_64
name=Cloudera's Distribution for Hadoop, Version 5
baseurl=https://archive.cloudera.com/cdh5/redhat/6/x86_64/cdh/5/
gpgkey =https://archive.cloudera.com/cdh5/redhat/6/x86_64/cdh/RPM-GPG-KEY-cloudera
gpgcheck = 1
操作示例:
mkdir /server/fuse_test01
hadoop-fuse-dfs dfs://fk.master01.com:8020 /server/fuse_test01
如果挂载报错,提示找不到/usr/lib64/libfuse.so.2,解决办法是:
yum install fuse-lib
(参考官网:https://centos.pkgs.org/7/centos-x86_64/fuse-libs-2.9.2-10.el7.x86_64.rpm.html)
再执行:
[root@slave26 lib64]# hadoop-fuse-dfs dfs://fk.master01.com:8020 /server/fuse_test01
INFO /data/jenkins/workspace/generic-package-rhel64-6-0/topdir/BUILD/hadoop-2.6.0-cdh5.15.1/hadoop-hdfs-project/hadoop-hdfs/src/main/native/fuse-dfs/fuse_options.c:164 Adding FUSE arg /server/fuse_test01
通过命令查看下
已经挂在成功
如果需要取消挂载的话,首先进入根目录:
cd /
umount /server/fuse_test01
/server/fuse_test01目录已经没有了!