2012年7月26日 星期四

KFS mount by Fuse

assumed you already installed KFS, and  KFS could be started as well. Then you could keep follow few steps below for mount it. KFS setup please refer to[KFS](KosmosFS) 安裝方法一
(1)stop metaservers and chunkservers
(2)yum install fuse-devel.x86_64 fuse-libs.x86_64 -y
(3)make sure CMakeLists.txt setting
    rpm -ql fuse-devel
   /lib64/libfuse.so
   /lib64/libulockmgr.so
   /usr/include/fuse
   /usr/include/fuse.h
   /usr/include/fuse/cuse_lowlevel.h
   /usr/include/fuse/fuse.h
   :
   :

    vi /usr/local/kfs-0.5/CMakeLists.txt
    # Fill in the path to fuse library
    SET(Fuse_LIBRARY_DIR "/lib64")          #go to line 136,137, XX_DIR should be the same with what rpm(fuse...rpm) you just installed
    SET(Fuse_INCLUDE_DIR "/usr/include")
(4)re-build KFS
    cd /usr/local/kfs-0.5/build
    cmake -D CMAKE_BUILD_TYPE=Release /usr/local/kfs-0.5/
        or
    cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo /usr/local/kfs-0.5/
    gmake
    gmake install

    #kfs_fuse will be built in /usr/local/kfs-0.5/build/bin

    cd /usr/local/kfs-0.5/scripts
    python kfssetup.py -f machines.cfg -m ../conf/machines.txt -b ../build -w ../webui

    #start you KFS
    python kfslaunch.py -f machines.cfg -m ../conf/machines.txt -s
(5)build a new prp file for fuse mounting


  look at the code src/cc/libkfsClient/KfsClient.cc:
  KfsClientPtr
  KfsClientFactory::GetClient(const char *propFile)
  {
      bool verbose = false;
  #ifdef DEBUG
      verbose = true;
  #endif
      if (theProps().loadProperties(propFile, '=', verbose) != 0) {
          KfsClientPtr clnt;
     return clnt;
      }

      return GetClient(theProps().getValue("metaServer.name", ""),
                       theProps().getValue("metaServer.port", -1));

  }

    cd /usr/local/kfs-0.5/build/bin
    vi kfs.prp     #it should be named kfs.prp compulsorily
    metaServer.name = metaserver    #not metaServer.host
    metaServer.port = 20000
(6)mount KFS
    cd /usr/local/kfs-0.5/build/bin
    mkdir -p /mnt/kfs
    ./kfs_fuse /mnt/kfs -f -o allow_other
    # -f : force the system to run the process in foreground
    # -o allow_other : allow other user to access the mount point

    mount
    :
    /dev/mapper/vg_01-lv_home on /home type ext4 (rw)
    none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
    kfs_fuse on /mnt/kfs type fuse.kfs_fuse (rw,nosuid,nodev,allow_other)


    ls -l /mnt/kfs
    total 0
    d--------- 0 root root    0 2012-07-25 11:00 dumpster
    d--------- 0 root root 9987 2012-07-26 15:12 hypertable

(7) FAQ
     1) Q:  kfs_fuse: /usr/include/boost/smart_ptr/shared_ptr.hpp:418:  T* boost::shared_ptr< >::operator->() const [with T = KFS::KfsClient]: Assertion `px != 0' failed.
        A:  look at your kfs.prp(exist ? typo ?), make sure metaServer.name (not metaServer.host)

     2) Q:  fuse: bad mount point `/mnt/kfs': Transport endpoint is not connected
         A:  if you had fixed all config files , but error again. Try to restart kfs service
            umount /mnt/kfs
            cd /usr/local/kfs-0.5/scripts
            python kfslaunch.py -f machines.cfg -m ../conf/machines.txt -S
            python kfslaunch.py -f machines.cfg -m ../conf/machines.txt -s
            cd /usr/local/kfs-0.5/build/bin
            ./kfs_fuse /mnt/kfs -f -o allow_other

reference :   http://yaronspace.cn/blog/archives/799



 

沒有留言:

張貼留言

文章分類