且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

mfs on ubuntu

更新时间:2022-10-02 20:24:45

   网上有很多 田逸老师的文章我就不多说些什么了.
            我说下在ubuntu 上安装过程!
 
元数据服务器    :MDT  192.168.6.132
数据存储服务器:MDS   192.168.6.133
客户端                 :client   192.168.6.134
客户端                 :client2   192.168.6.135
 
客户端通过fuse内核接口挂载元数据服务器,真实数据存在数据存储服务器!
 
软件:[url]http://www.moosefs.com/files/mfs-1.5.12.tar.gz[/url]   
需要库文件:libfuse-dev
 
1.安装元数据服务器    MDT  192.168.6.132
shell $> apt-get install  libfuse-dev
shell $> tar zxvf mfs-1.5.12.tar.gz
shell $> cd mfs-1.5.12
shell $> useradd mfs
shell $> ./configure --prefix=/usr/local/mfs --disable-mfsmount  --disable-mfschunkserver --enable-mfsmaster --with-default-user=mfs --with-default-group=mfs
shell $> make
shell $> make install
shell $> cd /usr/local/mfs
shell $> ls
etc  sbin  share  var
shell $> cd etc
shell $>  vim mfsmaster.cfg
#去掉所有注释 
WORKING_USER = mfs
 WORKING_GROUP = mfs
 LOCK_FILE = /var/run/mfs/mfsmaster.pid
 DATA_PATH = /usr/local/mfs/var/mfs
 SYSLOG_IDENT = mfsmaster
 BACK_LOGS = 50
 REPLICATIONS_DELAY_INIT = 300
 REPLICATIONS_DELAY_DISCONNECT = 3600
 MATOCS_LISTEN_HOST = *
 MATOCS_LISTEN_PORT = 9420
 MATOCU_LISTEN_HOST = *
 MATOCU_LISTEN_PORT = 9421
 CHUNKS_LOOP_TIME = 300
 CHUNKS_DEL_LIMIT = 100
 CHUNKS_REP_LIMIT = 15
shell $> mkdir -p /var/run/mfs
shell $> chown mfs.mms /var/run/mfs
shell $> /usr/local/mfs/sbin/mfsmaster start
shell $> netstat -ant
tcp        0      0 0.0.0.0:9420            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:9421            0.0.0.0:*               LISTEN
## 说明启动成功!
2.安装数据存储服务器!  MDS   192.168.6.133
shell $> apt-get install  libfuse-dev
shell $> tar zxvf mfs-1.5.12.tar.gz
shell $> cd mfs-1.5.12
shell $> useradd mfs
shell $> ./configure --prefix=/usr/local/mfs --disable-mfsmount  --enable-mfschunkserver --disable-mfsmaster --with-default-user=mfs --with-default-group=mfs
shell $> make
shell $> make install
shell $> cd /usr/local/mfs
shell $> ls
etc  sbin  share  var
shell $> cd etc
shell $> vim mfschunkserver.cfg
WORKING_USER = mfs
 WORKING_GROUP = mfs
 DATA_PATH = /usr/local/mfs/var/mfs
 LOCK_FILE = /var/run/mfs/mfschunkserver.pid
 SYSLOG_IDENT = mfschunkserver
 BACK_LOGS = 50
 MASTER_RECONNECTION_DELAY = 30
 MASTER_HOST = 192.168.6.132     ## 修改为元数据服务器IP地址!
 MASTER_PORT = 9420
 MASTER_TIMEOUT = 60
 CSSERV_LISTEN_HOST = *
 CSSERV_LISTEN_PORT = 9422
 CSSERV_TIMEOUT = 60
 CSTOCS_TIMEOUT = 60
 HDD_CONF_FILENAME = /usr/local/mfs/etc/mfshdd.cfg
shell $> vim mfshdd.cfg
/mnt/data
shell $> mkdir -p /mnt/data
shell $> chown mfs.mfs /mnt/data
shell $> mkdir -p /var/run/mfs
shell $> chown mfs.mfs /var/run/mfs
shell $> /usr/local/mfs/sbin/mfschunkserver start
shell $> netstat -ant
tcp        0      0 0.0.0.0:9422            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp        0      0 192.168.6.133:38318     192.168.6.132:9420      ESTABLISHED
3.安装客户端  client  192.168.6.134
shell $> apt-get install  libfuse-dev
shell $> tar zxvf mfs-1.5.12.tar.gz
shell $> cd mfs-1.5.12
shell $> useradd mfs
shell $> ./configure --prefix=/usr/local/mfs --enable-mfsmount  --disable-mfschunkserver --disable-mfsmaster --with-default-user=mfs --with-default-group=mfs
shell $> make
shell $> make install
shell $> cd /usr/local/mfs
shell $> ls
bin  etc  share
shell $> bin/mfsmount --help
mfsmount v. 1.5.12
usage: ./mfsmount [-r][-m][-c] [-v 0..2] [-h master host] [-p master port] [-l path] [-w mount point]
r: readonly mode
m: mount metadata
c: allow using cache
v: verbose level
defaults:
        h: mfsmaster    ###默认是 mfsmaster 计算机名
        p: 9421              ### 默认是 9421 端口
        l: /                      ### 默认被挂载路径
        w: /mnt/mfs      ### 默认挂载目录!
shell $> mkdir -p /mnt/mfs
shell $> bin/mfsmount -h 192.168.6.132    ###其他参数不用,使用默认!
shell $> mount
 
/dev/sda1 on / type ext3 (rw,relatime,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
/proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
varrun on /var/run type tmpfs (rw,nosuid,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
securityfs on /sys/kernel/security type securityfs (rw)
MFS on /mnt/mfs type fuse (rw,allow_other,default_permissions)
##说明挂载成功,新建文件与删除文件看看~
shell $> cd /mnt/mfs
shell $> touch aaa
shell $> ls
aaa
4.安装客户端2   client2 192.168.6.135
shell $> apt-get install  libfuse-dev
shell $> tar zxvf mfs-1.5.12.tar.gz
shell $> cd mfs-1.5.12
shell $> useradd mfs
shell $> ./configure --prefix=/usr/local/mfs --enable-mfsmount  --disable-mfschunkserver --disable-mfsmaster --with-default-user=mfs --with-default-group=mfs
shell $> make
shell $> make install
shell $> cd /usr/local/mfs
shell $> ls
bin  etc  share
shell $> mkdir -p /mnt/mfs
shell $> bin/mfsmount -h 192.168.6.132    ###其他参数不用,使用默认!
shell $> mount
/dev/sda1 on / type ext3 (rw,relatime,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
/proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
varrun on /var/run type tmpfs (rw,nosuid,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
securityfs on /sys/kernel/security type securityfs (rw)
MFS on /mnt/mfs type fuse (rw,allow_other,default_permissions)
5.测试客户端
shell $> cd /mnt/mfs
shell $> ls
aaa
####能看到数据!!!
shell $> rm  aaa
#### 切换到 客户端1   client   192.168.6.134  看一下
shell $> ls
 
###被删掉了!!!
shell $> umount /mnt/mfs
###卸载mfs文件系统
 
 
OK 安装完毕~~随后在写 数据恢复等~~

本文转自Deidara 51CTO博客,原文链接:http://blog.51cto.com/deidara/152586,如需转载请自行联系原作者