• mfs-管理员


    http://www.moosefs.org/
    http://moosefs.com/download.html

    两个手册于2015/03/05阅完

    moosefs-installation

    moosefs-users-manual

    CE版
    Community Edition
    Now you can install MooseFS in standard way using your favorite package manager on one of the following platforms using officially supported repository:

        Ubuntu 10/12/14
        Debian 5/6/7
        RHEL/CentOS versions 5/6
        OpenSUSE 12
        FreeBSD 9.3/10
        MacOS X 10.9

    To get more information on how to install Community Edition of the product please read the instructions specific to your platform.

    Repository branches
    Our repository contains two branches: stable and current.
    Version from stable branch has been tested both in the production and in our test environment. Version from current branch - only in our test environment.

    PRO版
    MooseFS Professional
    MooseFS PRO is also available from the repositories in binaries, but to run it the appropriate license key is needed.



    介绍    INTRO
    MooseFS is a fault tolerant, network distributed file system. It spreads data over several physical servers which are visible to the user as one resource. For standard file operations MooseFS acts as other Unix-alike file systems:

    架构    ARCHITECTURE
    MooseFS consists of four components:
    master server
    chunk server
    metalogger server
    mfsmount    mfsmount is based on the FUSE mechanism (Filesystem in USErspace), so MooseFS is available on every Operating System with a working FUSE implementation (Linux, FreeBSD, MacOS X, etc.)  

    系统如何工作    HOW THE SYSTEM WORKS

    容错    fault tolerant

    PLATFORMS
      MooseFS is available on every Operating System with a working FUSE implementation:
        Linux (Linux 2.6.14 and up have FUSE support included in the official kernel)
        FreeBSD
        OpenSolaris
        MacOS X
    The master server, metalogger server and chunkservers can also be run on Solaris or Windows with Cygwin. Unfortunately without FUSE it won't be possible to mount the filesystem within these operating systems.


    这样以后就可以yum直接下载了
    curl "http://ppa.moosefs.com/RPM-GPG-KEY-MooseFS" > /etc/pki/rpm-gpg/RPM-GPG-KEY-MooseFS
    curl "http://ppa.moosefs.com/MooseFS-stable-rhsysv.repo" > /etc/yum.repos.d/MooseFS.repo

    依赖于libpcap包
    For Master Servers:
    # yum install moosefs-ce-master
    # yum install moosefs-ce-cli

    For Chunkservers:
    # yum install moosefs-ce-chunkserver
    Installing:
     moosefs-ce-chunkserver                    x86_64                    2.0.50-1.rhsysv                                         MooseFS                    120 k
    Installing for dependencies:
     libpcap                                   x86_64                    14:1.4.0-1.20130826git2dbcaa1.el6                       base                       130 k

    可以做为master的备份之用
    For Metaloggers:
    # yum install moosefs-ce-metalogger

    For Clients:
    # yum install moosefs-ce-client
    Installing:
     moosefs-ce-client                      x86_64                      2.0.50-1.rhsysv                                        MooseFS                      145 k
    Installing for dependencies:
     fuse-libs                              x86_64                      2.8.3-4.el6                                            base                          74 k
     libpcap                                x86_64                      14:1.4.0-1.20130826git2dbcaa1.el6                      base                         130 k

    For cgi:
    # yum install moosefs-ce-cgiserv
    Installing:
     moosefs-ce-cgiserv                          x86_64                          2.0.50-1.rhsysv                          MooseFS                           24 k
    Installing for dependencies:
     moosefs-ce-cgi                              x86_64                          2.0.50-1.rhsysv                          MooseFS                           61 k

    安装完管理服务器后,便可以用mfsmaster命令来启动master server,如果用root用户执行mfsmaster命令,则在启动后转为mfsmaster.cfg中指定的用户来运行,否则将以执行mfsmaster命令的用户来运行master server。

    Master的配文
    [root@mfs-master mfs]# vi mfsexports.cfg
    [root@mfs-master mfs]# vi mfstopology.cfg
    [root@mfs-master mfs]# vi mfsmaster.cfg
    mfsmaster.cfg是主配置文件,mfsexports.cfg是被挂接目录及权限设置。

    Metaloggers的配文
    [root@mfs-master mfs]# vi mfsmetalogger.cfg

    Chunk的配文
    mfschunkserver.cfg是主配置文件,mfshdd.cfg是服务器用来分配给 MFS使用的空间,最好是一个单独的硬盘或者一个raid卷,最低要求是一个分区。

    master: /var/lib/mfs下的metadata.mfs文件是当前的metadata,默认每小时都会更新,旧文件将会添加.back后缀备份即可,并同时增加changelog.*.log。当然,推荐使用moosefs metalogger来作备份恢复。

    mfsexports.cfg的配置
    [root@nas etc]# vi mfsexports.cfg  
    #*                      /       ro
    #192.168.1.0/24         /       rw
    #192.168.1.0/24         /       rw,alldirs,maproot=0,password=passcode
    #10.0.0.0-10.0.0.5      /test   rw,maproot=nobody,password=test
    *                       .       rw
    #*                      /       rw,alldirs,maproot=0
    192.168.3.98            /tt     rw,alldirs,maproot=0
    192.168.3.139           /       rw,alldirs,maproot=0
    192.168.3.138           /       rw,alldirs,maproot=0,password=111111
    该文件每一个条目分为三部分:
    第一部分:客户端的ip地址
    第二部分:被挂接的目录
    第三部分:客户端拥有的权限
    
    地址可以指定的几种表现形式:
           *                  所有的ip地址
           n.n.n.n             单个ip地址
           n.n.n.n/b           IP网络地址/位数掩码
           n.n.n.n/m.m.m.m     IP网络地址/子网掩码
           f.f.f.f-t.t.t.t     IP段
    
    目录部分需要注意两点:
    / 标识MooseFS 根;
    . 表示MFSMETA 文件系统
    
    权限部分:
           ro  只读模式共享
           rw  的方式共享
           alldirs  许挂载任何指定的子目录
           maproot   映射为root,还是指定的用户
           password  指定客户端密码


    Cgiserv
    Mfscgiserv是用python编写的一个web服务器,它的监听端口是9425,
    可以利用:/usr/local/mfs/sbin/mfscgiserv来启动,用户利用浏览器就可全面监控所有客户挂接,chunkserver及master server,客户端的各种操作等等,绝对是个好工具。
    在任何一台装有浏览器的机器上都可以查看:http://192.168.3.34:9425
    http://192.168.2.231:9425/

    启动master server
    master server可以单独启动(所谓单独启动就是在没有数据存储服务器(chunkserver)的时候也可以启动,但是不能存储,chunkserver启动后会自动的加入)。安装配置完MFS后,即可启动它。

    [root@mfs-master mfs]# service mfsmaster start
    Starting mfsmaster:                                        [FAILED]
    [root@mfs-master mfs]# pwd
    /var/lib/mfs
    [root@mfs-master mfs]# ll
    total 4
    -rwxr--r-- 1 mfs mfs 8 Feb 10 19:27 metadata.mfs.empty
    [root@mfs-master mfs]# cp metadata.mfs.empty metadata.mfs
    [root@mfs-master mfs]# ll
    total 8
    -rwxr--r-- 1 root root 8 Feb 28 16:43 metadata.mfs
    -rwxr--r-- 1 mfs  mfs  8 Feb 10 19:27 metadata.mfs.empty
    [root@mfs-master mfs]# service mfsmaster start
    Starting mfsmaster:                                        [  OK  ]

    [root@mfs-chunk1 mfs]# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
    [root@mfs-chunk1 mfs]# echo 'MASTER_HOST = 192.168.2.231' >> /etc/mfs/mfschunkserver.cfg
    [root@mfs-chunk1 mfs]# mkdir /sh
    [root@mfs-chunk1 mfs]# chown -R mfs:mfs /sh
    [root@mfs-chunk1 mfs]# echo '/sh' >> /etc/mfs/mfshdd.cfg
    [root@mfs-chunk1 mfs]# service mfschunkserver start
    Starting mfschunkserver:                                   [  OK  ]

    在开始mfsmount进程时,用一个-m或-o mfsmeta的选项,这样可以挂接一个辅助的文件系统MFSMETA,这么做的目的是对于意外的从MooseFS卷上删除文件或者是为了释放磁盘空间而移动的文件而又此文件又过去了垃圾文件存放期的恢复,例如:
    mfsmount -m /mnt/mfsmeta
    需要注意的是,如果要决定挂载mfsmeta,那么一定要在mfsmaster的mfsexports.cfg文件中加入如下条目:
    *                       .       rw
    [root@mfs-client mnt]# mfsmount -m /mnt/mfsmeta/ -H 192.168.2.231
    mfsmaster accepted connection with parameters: read-write,restricted_ip
    [root@mfs-client ~]# mkdir /mfs
    [root@mfs-client ~]# mfsmount /mfs/ -H 192.168.2.231
    mfsmaster accepted connection with parameters: read-write,restricted_ip ; root mapped to root:root
    [root@mfs-client mfs]# df -h
    Filesystem                    Size  Used Avail Use% Mounted on
    /dev/mapper/VolGroup-lv_root   15G  780M   13G   6% /
    tmpfs                         246M     0  246M   0% /dev/shm
    /dev/sda1                     485M   32M  428M   7% /boot
    192.168.2.231:9421             26G     0   26G   0% /mfs


    在一个客户端上做操作
    [root@mfs-client mfs]# pwd
    /mfs
    这次写到chunk1上
    [root@mfs-client mfs]# echo wo >d
    这次写到chunk2上
    [root@mfs-client mfs]# echo wo >e

    [root@mfs-chunk1 sh]# ls -R
    ./02:
    chunk_0000000000000002_00000001.mfs

    ./03:

    ./04:
    chunk_0000000000000004_00000001.mfs

    [root@mfs-chunk2 sh1]# ls -R
    ./01:
    chunk_0000000000000001_00000001.mfs

    ./02:

    ./03:
    chunk_0000000000000003_00000001.mfs

    暂不支持master主备的热切换问题,后期测试成熟打算改用corosync+pacemaker+mfsmaster+metalog方案实现。
    Chunk上的每个挂载点存储目录00-FF,共256个。每单个文件最大上限64M,超过64M目录下会循环生成下一个文件。
    2.3 metalogger的注意事项
    1)部署metalogger的服务器的open files数目必须大于或者等于5000,
    2)metalogger在启动时不会下载metadata,而是等到第一个下载周期的下载时间点时再去下载,metalogger下载metadata的时间点是每小时的10分30秒,时间间隔是1小时的整数倍。
    3) metalogger不是在启动的时候就取下载metadata,而是必须等到下载时间点(2中所述)才会去下载。也就是说,metalogger为确保正确性,要在启动后最少一个小时以内master和metalogger都要保持良好的状态。

    BACK_LOGS说明:
    通常元数据有两部分的数据:
    3.1)主要元数据文件metadata.mfs,当mfsmaster运行的时候会被命名为 metadata.mfs.back
    3.2)元数据改变日志changelog.*.mfs,存储了过去的N小时的文件改变(N的数值是由BACK_LOGS参数设置的)。
    主要的元数据文件需要定期备份,备份的频率取决于多少小时changelogs储存。元数据changelogs应该实时的自动复制。自从MooseFS 1.6.5,这两项任务是由mfsmetalogger守护进程做的。
    BACK_LOGS = 24   需和metalogger server上配置一致,,存储了过去的24小时的元数据改变日志changelog.*.mfs.

    开机自动启动
    下面这一步添加的名字是/etc/rc.d/init.d/这里面启动脚本的名称
    [root@mfs-chunk1 mfs]# chkconfig --add mfschunkserver
    [root@mfs-chunk1 mfs]# chkconfig --level 2345 mfschunkserver on

    高可用方案
    两个keepalived.conf,两个脚本。
    
    [root@mfs-master mfs]# curl -O http://www.keepalived.org/software/keepalived-1.2.13.tar.gz
    [root@mfs-master mfs]# tar zxvf keepalived-1.2.13.tar.gz
    [root@mfs-master mfs]# yum install gcc openssl-devel -y
    [root@mfs-master ~]# cat /usr/local/etc/keepalived/keepalived.conf
    ! Configuration File for keepalived
    global_defs {
       router_id LVS_STTD
    }
    vrrp_script check_run {
       script "/root/keepalived_check_mfsmaster.sh"
       interval 2
    }
    vrrp_sync_group VG1 {
        group {
              VI_1
        }
    }
    vrrp_instance VI_1 {
        state MASTER
        interface eth0
        virtual_router_id 88
        priority 100
        advert_int 1
        nopreempt
        authentication {
            auth_type PASS
            auth_pass 1111
        }
        track_script {
            check_run
        }
        virtual_ipaddress {
            192.168.2.230
        }
    }
    [root@mfs-master ~]# cat keepalived_check_mfsmaster.sh
    #!/bin/sh
    CHECK_TIME=2
    mfspath="/usr/sbin/mfsmaster"
    function check_mfsmaster () {
    ps -ef | grep mfsmaster | grep -v "grep"
        if [ $? = 0 ] ;then
            MFS_OK=1
        else
            MFS_OK=0
        fi
        return $MFS_OK
    }
    while [ $CHECK_TIME -ne 0 ]
    do
            let "CHECK_TIME -= 1"
            check_mfsmaster
            if [ $MFS_OK = 1 ] ; then
                    CHECK_TIME=0
                    exit 0
            fi
    
            if [ $MFS_OK -eq 0 ] &&  [ $CHECK_TIME -eq 0 ] ;then
                    /etc/init.d/keepalived stop
                    exit 1
            fi
    done
    
    备机上
    [root@mfs-back mfs]# curl -O http://www.keepalived.org/software/keepalived-1.2.13.tar.gz
    [root@mfs-back mfs]# tar zxvf keepalived-1.2.13.tar.gz
    [root@mfs-back mfs]# yum install gcc openssl-devel -y
    [root@mfs-back keepalived]# cat keepalived.conf
    ! Configuration File for keepalived
    global_defs {
       router_id LVS_STTD
    }
    vrrp_sync_group VG1 {
        group {
              VI_1
        }
    notify_master "/root/keepalived_notify.sh master"
    notify_backup "/root/keepalived_notify.sh backup"
    }
    vrrp_instance VI_1 {
        state BACKUP
        interface eth1
        virtual_router_id 88
        priority 80
        advert_int 1
        authentication {
            auth_type PASS
            auth_pass 1111
        }
        virtual_ipaddress {
            192.168.2.230
        }
    }
    
    [root@mfs-back ~]# cat keepalived_notify.sh
    #!/bin/bash
    
    MFS_HOME=/Data/apps/mfs
    MFSMARSTER=${MFS_HOME}/sbin/mfsmaster
    MFSMETARESTORE=${MFS_HOME}/sbin/mfsmetarestore
    MFS_DATA_PATH=${MFS_HOME}/var/mfs
    
    function backup2master(){
    $MFSMETARESTORE -m ${MFS_DATA_PATH}/metadata.mfs.back -o ${MFS_DATA_PATH}/metadata.mfs $MFS_DATA_PATH/changelog_ml*.mfs
    $MFSMARSTER start
    }
    
    function master2backup(){
    $MFSMARSTER stop
    /Data/apps/mfs/sbin/mfsmetalogger start
    }
    
    function ERROR(){
    echo "USAGE: keepalived_notify.sh master|backup "
    }
    
    case $1 in
            master)
            backup2master
            ;;
            backup)
            master2backup
            ;;
            *)
            ERROR
            ;;
    esac
  • 相关阅读:
    防止域名恶意指向的解决办法
    Spring @Configuration @Import
    CAS 集成认证
    远程桌面登录蓝色屏幕、不显示桌面怎么解决?
    终端服务器超出了最大允许连接数
    Fiddler 常见几种解决捕获不到请求的方法
    android TimerTask 的简单应用
    Android 数字签名学习笔记
    Android 遍历卡数据并按图片,音乐等分类保存
    Android 最简单的SD卡文件遍历程序
  • 原文地址:https://www.cnblogs.com/createyuan/p/4305151.html
Copyright © 2020-2023  润新知