使用Fuse挂载HDFS

matengzz 2011-09-13

前提,已经安装好hadoop集群

1.安装fuse

这里可以编译安装或yum安装

   
yum install fuse fuse-libs fuse-devel
 

2.安装ant

使用yum安装

yum install ant
 

3.添加系统配置

vi/etc/profile,视自己的实际情况进行设置

export OS_ARCH=amd64
export OS_BIT=64
export JAVA_HOME=/usr/java/jdk1.6.0_26
export CLASSPATH=,:$JAVA_HOME/lib
export HADOOP_HOME=/usr/local/hadoop-0.20.2
export LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/$OS_ARCH/server:$HADOOP_HOME/c++/Linux-$OS_ARCH-$OS_BIT/lib:/usr/local/lib:/usr/lib
source /etc/profile
 

4.进行编译

cd $HADOOP_HOME
ant compile-c++-libhdfs -Dlibhdfs=1 -Dcompile.c++=1
ln -s c++/Linux-$OS_ARCH-$OS_BIT/lib build/libhdfs
ant compile-contrib -Dlibhdfs=1 -Dfusedfs=1
 

5.测试

启动hadoop集群后,

   
mkdir /mnt/dfs
cd $HADOOP_HOME/build/contrib/fuse-dfs
./fuse_dfs_wrapper.sh dfs://namenode:9000 /mnt/dfs/
ls /mnt/dfs/
 

相关推荐