Hadoop HDFS 配置 挂载HDFS文件系统

tar zxvf    fuse-2.8.1.tar.gz
cd fuse2.8.1
./configure --prefix=/usr/
make
make install
modprobe fuse

 

vi /etc/sysconfig/modules/my.modules 
#!/bin/sh
modprobe fuse >/dev/null 2>&1
chmod +x /etc/sysconfig/modules/my.modules

2、Ant安装

wget
tar zxvf apache-ant-1.7.1-bin.tar.g
mv apache-ant-1.7.1-bin.tar.g /usr/local/ant

3、环境变量设置

export Java_HOME=/usr/local/1dk1.6
export Hadoop_HOME=/data/soft/hadoop-2.20.1
export OS_ARCH=amd64
export OS_BIT=32                    //如果系统是64位的,这里应该写64
export LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/$OS_ARCH/server:${HADOOP_HOME}/build/c++/Linux-$OS_ARCH-$OS_BIT/lib:/usr/local/lib:/usr/lib
export ANT_HOME=/usr/local/ant
export PATH=$ANT_HOME/bin:$PATH

 

4、libhdfs 制作

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

 

5、fuse-dfs

cd $HADOOP_HOME

ant compile-contrib -Dlibhdfs=1 -Dfusedfs=1

6、fuse配置  /usr/local/bin/fuser_dfs_wrapper.sh

export JAVA_HOME=/usr/local/jdk1.6
export HADOOP_HOME=/data/soft/hadoop-2.20.1

export HADOOP_CONF_DIR=/data/soft/hadoop-0.20.1/conf
export OS_ARCH=i386
export OS_BIT=32

//以上都是新增加的内容

 

if [ "$HADOOP_HOME" = "" ]; then
export HADOOP_HOME=/usr/local/share/hadoop
fi

export PATH=$HADOOP_HOME/contrib/fuse_dfs:$PATH

for f in ls $HADOOP_HOME/lib/*.jar $HADOOP_HOME/*.jar ; do
export  CLASSPATH=$CLASSPATH:$f
done

if [ "$OS_ARCH" = "" ]; then
export OS_ARCH=amd64
fi

if [ "$JAVA_HOME" = "" ]; then
export  JAVA_HOME=/usr/local/java
fi

if [ "$LD_LIBRARY_PATH" = "" ]; then
export LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/$OS_ARCH/server:/usr/local/share/hdfs/libhdfs/:/usr/local/lib
fi

./fuse_dfs $@ //修改成以下内容

fuse_dfs $@  //这里要把前面的./去掉,要不然挂载hdfs文件系统会找不到fuse_dfs文件

7、设置文件权限

chmod +x /data/soft/hadoop-2.20.1/build/contrib/fuse-dfs/fuse_dfs_wrapper.sh
chmod +x /data/soft/hadoop-2.20.1/build/contrib/fuse-dfs/fuse_dfs
ln -s /data/soft/hadoop-2.20.1/build/contrib/fuse-dfs/fuse_dfs_wrapper.sh /usr/local/bin
ln -s /data/soft/hadoop-2.20.1/build/contrib/fuse-dfs/fuse_dfs /usr/local/bin/
mkdir /mnt/dfs

 

8、手动挂载hdfs文件系统

fuse_dfs_wrapper.sh dfs://192.168.1.11:9000 /mnt/dfs

 

9、开机自动挂载hdfs文件系统

vi /etc/fstab
fuse_dfs_wrapper.sh dfs://192.168.1.11:9000 /mnt/dfs    fuse rw,auto 0 0

10,/etc/fuse.conf 配置文件

user_allow_other

mount_max=100

 

10,日志文件

tail -f /var/log/message

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/1976a93bc66171119a25908dfa4d3926.html