分布式文件系统之MFS
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了分布式文件系统之MFS相关的知识,希望对你有一定的参考价值。
本博客是为了方便博主自己查看大致流程,不要作为学习参考。
环境: centos6.6
mfs- - master 192.168.1.220
mfs- - metalogger 192.168.1.225
mfs- - chunkserver- -1 1 192.168.1.221
mfs- - chunkserver- -2 2 192.168.1.218
mfs- - client 192.168.1.224
部署
#安装Master Server(mfs-master) yum install zlib-devel gcc -y groupadd -g 1000 mfs useradd -u 1000 -g mfs -s/sbin/nologin mfs yum install wget –y wget http://moosefs.org/tl_files/mfscode/mfs-1.6.27-5.tar.gz tar xf mfs-1.6.27-5.tar.gz cd mfs-1.6.2 ./configure--prefix=/usr/local/mfs-1.6.27 --with-default-user=mfs --with-default-group=mfs --disable-mfschunkserver --disable-mfsmount make&&make install ln -s /usr/local/mfs-1.6.27/usr/local/mfs #配置Master Server cd /usr/local/mfs/etc/mfs/ cp mfsexports.cfg.distmfsexports.cfg cp mfsmaster.cfg.distmfsmaster.cfg catmfsmaster.cfg # WORKING_USER = mfs # 运行 masterserver 的用户 # WORKING_GROUP = mfs # 运行 masterserver 的组 # SYSLOG_IDENT = mfsmaster # 是masterserver在syslog中的标识,也就是说明这是由masterserve产生的 # LOCK_MEMORY = 0 # 是否执行mlockall()以避免mfsmaster 进程溢出(默认为0) # NICE_LEVEL = -19 # 运行的优先级(如果可以默认是 -19; 注意: 进程必须是用root启动) # EXPORTS_FILENAME = /usr/local/mfs-1.6.27/etc/mfs/mfsexports.cfg # 被挂载目录及其权限控制文件的存放路径 # TOPOLOGY_FILENAME = /usr/local/mfs-1.6.27/etc/mfs/mfstopology.cfg #mfstopology.cfg文件的存放路径 # DATA_PATH = /usr/local/mfs-1.6.27/var/mfs # 数据存放路径,此目录下大致有三类文件,changelog,sessions和stats; # BACK_LOGS = 50 #metadata的改变log文件数目(默认是 50) # BACK_META_KEEP_PREVIOUS = 1 # metadata的默认保存份数(默认为1) # REPLICATIONS_DELAY_INIT = 300 # 延迟复制的时间(默认是300s) # REPLICATIONS_DELAY_DISCONNECT = 3600 # chunkserver断开的复制延迟(默认是3600) # MATOML_LISTEN_HOST = * # metalogger监听的IP地址(默认是*,代表任何IP) # MATOML_LISTEN_PORT = 9419 # metalogger监听的端口地址(默认是9419) # MATOML_LOG_PRESERVE_SECONDS = 600 # MATOCS_LISTEN_HOST = * # 用于chunkserver连接的IP地址(默认是*,代表任何IP) # MATOCS_LISTEN_PORT = 9420 # 用于chunkserver连接的端口地址(默认是9420) # MATOCL_LISTEN_HOST = * # 用于客户端挂接连接的IP地址(默认是*,代表任何IP) # MATOCL_LISTEN_PORT = 9421 # 用于客户端挂接连接的端口地址(默认是9421) # CHUNKS_LOOP_MAX_CPS = 100000 # chunks的最大回环频率(默认是:100000秒) # CHUNKS_LOOP_MIN_TIME = 300 # chunks的最小回环频率(默认是:300秒) # CHUNKS_SOFT_DEL_LIMIT = 10 # 一个chunkserver中soft最大的可删除数量为10个 # CHUNKS_HARD_DEL_LIMIT = 25 # 一个chuankserver中hard最大的可删除数量为25个 # CHUNKS_WRITE_REP_LIMIT = 2 # 在一个循环里复制到一个chunkserver的最大chunk数目(默认是1) # CHUNKS_READ_REP_LIMIT = 10 # 在一个循环里从一个chunkserver复制的最大chunk数目(默认是5) # ACCEPTABLE_DIFFERENCE = 0.1 # 每个chunkserver上空间使用率的最大区别(默认为0.01即1%) # SESSION_SUSTAIN_TIME = 86400 # 客户端会话超时时间为86400秒,即1天 # REJECT_OLD_CLIENTS = 0 # 弹出低于1.6.0的客户端挂接(0或1,默认是0) # deprecated: # CHUNKS_DEL_LIMIT - use CHUNKS_SOFT_DEL_LIMIT instead # LOCK_FILE - lock system has been changed, and this option is used onlyto search for old lockfile #启动停止Master Server /usr/local/mfs/sbin/mfsmasterstart /usr/local/mfs/sbin/mfsmasterstop #配置环境变量并开机自启动 echo ‘# addmoosefs to the path variable‘ >> /etc/profile echo‘PATH=/usr/local/mfs/sbin/:$PATH‘ >> /etc/profile tail -2/etc/profile # add moosefs to the path variable PATH=/usr/local/mfs/sbin/:$PATH source/etc/profile #开机自启: echo ‘#Configure the mfsmaster service startup‘ >> /etc/rc.local echo‘/usr/local/mfs/sbin/mfsmaster start‘ >> /etc/rc.local tail -2/etc/rc.local #部署Metalogger Server(备机) yum install zlib-devel gcc -y groupadd -g 1000 mfs useradd -u 1000 -g mfs -s /sbin/nologin mfs yum install wget –y wget http://moosefs.org/tl_files/mfscode/mfs-1.6.27-5.tar.gz tar xf mfs-1.6.27-5.tar.gz cd mfs-1.6.27 ./configure--prefix=/usr/local/mfs-1.6.27 --with-default-user=mfs --with-default-group=mfs --disable-mfschunkserver --disable-mfsmount make&&make install ln -s /usr/local/mfs-1.6.27 /usr/local/mfs #配置Metalogger Server cd /usr/local/mfs/etc/mfs/ cp mfsmetalogger.cfg.dist mfsmetalogger.cfg cat mfsmetalogger.cfg # WORKING_USER = mfs # WORKING_GROUP = mfs # SYSLOG_IDENT = mfsmetalogger # LOCK_MEMORY = 0 # NICE_LEVEL = -19 # DATA_PATH =/usr/local/mfs-1.6.27/var/mfs # BACK_LOGS = 50 # BACK_META_KEEP_PREVIOUS = 3 #META_DOWNLOAD_FREQ = 24 启动Metalogger Serve服务 /usr/local/mfs/sbin/mfsmetalogger start netstat -lantp|grep metalogger tailf /var/log/messages #部署 Chunk Servers1 yum install gcc zlib-devel -y groupadd -g 1000 mfs useradd -u 1000 -g mfs mfs -s/sbin/nologin yum install wget –y wget http://moosefs.org/tl_files/mfscode/mfs-1.6.27-5.tar.gz tar zxf mfs-1.6.27-5.tar.gz cd mfs-1.6.27 ./configure --prefix=/usr/local/mfs-1.6.27--with-default-user=mfs --with-default-group=mfs --disable-mfsmaster --disable-mfsmount make&&make install ln -s /usr/local/mfs-1.6.27/usr/local/mfs #配置ChunkServers cd/usr/local/mfs/etc/mfs cpmfschunkserver.cfg.dist mfschunkserver.cfg cpmfshdd.cfg.dist mfshdd.cfg cat mfschunkserver.cfg #WORKING_USER = mfs #WORKING_GROUP = mfs #SYSLOG_IDENT = mfschunkserver #LOCK_MEMORY = 0 #NICE_LEVEL = -19 #DATA_PATH = /usr/local/mfs-1.6.27/var/mfs #MASTER_RECONNECTION_DELAY = 5 #BIND_HOST = * MASTER_HOST= 192.168.1.220 # 该地址为 Master Server 的IP地址或者主机名 #MASTER_PORT = 9420 #MASTER_TIMEOUT = 60 #CSSERV_LISTEN_HOST = * #CSSERV_LISTEN_PORT = 9422 # 该端口用于与其它chunk server之间的通信,主要是数据复制 #HDD_CONF_FILENAME = /usr/local/mfs-1.6.27/etc/mfs/mfshdd.cfg #HDD_TEST_FREQ = 10 #deprecated, to be removed in MooseFS 1.7 #LOCK_FILE = /var/run/mfs/mfschunkserver.lock #BACK_LOGS = 50 #CSSERV_TIMEOUT = 5 #启动ChunkServer服务 chown -R mfs.mfs /mfsdata/ #注意:必须给mfs足够的权限,否则会报错。 /usr/local/mfs/sbin/mfschunkserverstart #关闭ChunkServer /usr/local/mfs/sbin/mfschunkserver stop #配置环境变量并开机自启 #环境变量 echo ‘# add moosefs to the pathvariable‘ >> /etc/profile echo ‘PATH=/usr/local/mfs/sbin/:$PATH‘>> /etc/profile tail -2 /etc/profile # add moosefs to the path variable PATH=/usr/local/mfs/sbin/:$PATH source /etc/profile #开机自启 echo ‘# Configure the mfschunkserverservice startup‘ >> /etc/rc.local echo ‘/usr/local/mfs/sbin/mfschunkserverstart‘ >> /etc/rc.local tail -2 /etc/rc.local # Configure the metalogger servicestartup /usr/local/mfs/sbin/mfsmetalogger start #客户端挂载 yum install fuse –y wget http://jaist.dl.sourceforge.net/project/fuse/fuse-2.X/2.9.3/fuse-2.9.3.tar.gz tar zxf fuse-2.9.3.tar.gz cd fuse-2.9.3 ./configure make && make install #配置环境变量 echo ‘exportPKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH‘ >>/etc/profile source /etc/profile #加载fuse模块到内核并配置开机自启 lsmod |grep fuse modprobe fuse lsmod |grep fuse fuse 79956 0 echo ‘modeprobe fuse‘ >>/etc/sysconfig/modules/fuse.modules cat /etc/sysconfig/modules/fuse.modules modeprobe fuse chmod 755/etc/sysconfig/modules/fuse.modules 安装mfsmount yum install zlib-devel gcc –y groupadd -g 1000 mfs useradd -u 1000 -g mfs mfs -s/sbin/nologin wget http://moosefs.org/tl_files/mfscode/mfs-1.6.27-5.tar.gz tar zxf mfs-1.6.27-5.tar.gz cd mfs-1.6.27 ./configure--prefix=/usr/local/mfs-1.6.27 --with-default-user=mfs --with-default-group=mfs--disable-mfsmaster --disable-mfschunkserver --enable-mfsmount 如果有错误 configure: error: mfsmount build wasforced, but fuse library is too old or not installed yum install fuse-devel –y make&&make install ln -s /usr/local/mfs-1.6.27/usr/local/mfs bin是客户端的命令 创建目录并挂载 mkdir /mfsdata chown -R mfs.mfs /mfsdata ll -d /mfsdata/ drwxr-xr-x 2 mfs mfs 4096 4月 28 12:19/mfsdata/ /usr/local/mfs/bin/mfsmount /mfsdata -H192.168.1.220 -p
本文出自 “永不放弃! 任志远” 博客,谢绝转载!
以上是关于分布式文件系统之MFS的主要内容,如果未能解决你的问题,请参考以下文章