Master 1 client 6 chunkserver 2 5
master端:
mv moosefs-3.0.80-1.tar.gz moosefs-3.0.80.tar.gz
Rpmbuild -tb moosefs-3.0.80.tar.gz
缺少依赖性:yum install libpcap-1.4.0-4.20130826git2dbcaa1.el6.x86_64.rpm -y
yum install libpcap-devel-1.4.0-4.20130826git2dbcaa1.el6.x86_64.rpm -y
cd ~/rpmbuild/RPMS/x86_64
yum install -y moosefs-cgi-3.0.80-1.x86_64.rpm
moosefs-cgiserv-3.0.80-1.x86_64.rpm
moosefs-master-3.0.80-1.x86_64.rpm
moosefs-cli-3.0.80-1.x86_64.rpm
moosefs-netdump-3.0.80-1.x86_64.rpm
添加解析 在master地址后添加 mfsmaster
执行 mfsmaster mfscgiserv
访问http://172.25.60.1:9425
Server 2 5
moosefs-chunkserver-3.0.80-1.x86_64.rpm
vim /etc/mfs/mfshhd.cfg 最下一行添加:/mnt/chunk1 2 chown mfs.mfs /mnt/chunk 1 2
在hosts里添加master端的解析:mfsmaster
开启服务 mfschunkserver
server6 client端
安装moosefs-client
Vim /etc/mfs/mfsmount.cfg在最后一行添加:/mnt/mfs
在hosts里添加server 端解析 mfsmaster
Mkdir /mnt/mfs
执行mfsmountdf查看挂载
测试:
cd /mnt/mfs mkdir dir1 dir2
Mfssetgoal -r 1 dir1 mfssetgoal -r 2 dir2 #####dir1里只存储一份 dir2里存储两份
Mfsgetgoal dir1 查看更改
数据误删除恢复:
假如删除了 dir1/passwd
建立目录 /mnt/mfsmeta
Mfsmount -m /mnt/mfsmeta
Cd /mfsmeta/trashfind -type f
Mv ./004/00000004/|dir1\|passwdundel
解决单点故障:
采用pacemaker+iscsi
先做iscsi
将/var/log/mfs/* 拷贝到此块设备中 并更改为mfs.mfs
出现的错误:在第一个master上能够成功启动,但在第二个master上启动失败了,
原因:在第二个用户上没有mfs用户导致权限出现问题
安装pacemaker corosync pssh-2.3.1-4.1.x86_64.rpm crmsh-1.2.6-0.rc2.2.1.x86_64.rpm
在两个节点上Yum install pacemaker corosync
Cd /etc/corosync cp corosync.conf.example corosync.conf
同步两端的此配置文件
启动两端服务 /etc/init.d/corosync start
将mfs启动的脚本文件放入 init.d中:
#!/bin/bash
#
#Init file for the MooseFS master service
#
#chkconfig: - 92 84
#
#description: MooseFS master
#
#processname: mfsmaster
#Source function library.
#Source networking configuration.
. /etc/init.d/functions
. /etc/sysconfig/network
# Source initialization configuration.
# Check that networking is up.
[ "${NETWORKING}" == "no" ] && exit 0
[ -x "/usr/sbin/mfsmaster" ] || exit 1
[ -r "/etc/mfs/mfsmaster.cfg" ] || exit 1
[ -r "/etc/mfs/mfsexports.cfg" ] || exit 1
RETVAL=0
prog="mfsmaster"
datadir="/var/lib/mfs"
mfsbin="/usr/sbin/mfsmaster"
mfsrestore="/usr/sbin/mfsmetarestore"
start () {
echo -n $"Starting $prog: "
$mfsbin >/dev/null 2>&1
if [ $? -ne 0 ];then
$mfsbin -a >/dev/null 2>&1
fi
RETVAL=$?
echo
return $RETVAL
}
stop () {
echo -n $"Stopping $prog: "
$mfsbin stop >/dev/null 2>&1 || killall -9 $prog #>/dev/null 2>&1
RETVAL=$?
echo
return $RETVAL
}
restart () {
stop
start
}
reload () {
echo -n $"reload $prog: "
$mfsbin reload >/dev/null 2>&1
RETVAL=$?
echo
return $RETVAL
}
restore () {
echo -n $"restore $prog: "
$mfsbin -a >/dev/null 2>&1
RETVAL=$?
echo
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
reload
;;
restore)
restore
;;
status)
status $prog
RETVAL=$?;;
*)
echo $"Usage: $0 {start|stop|restart|reload|restore|status}"
RETVAL=1
esac
exit $RETVAL
为脚本文件添加执行权限并拷贝至另一节点
添加策略
关闭fence: property stonith-enabled=false
添加vip:primitive vip ocf:heartbeat:IPaddr2 params ip=172.25.60.100 cidr_netmask=32 op monitor interval=20s
添加脚本启动:primitive mfsmaster lsb:mfsd op monitor
添加挂载:
primitive mfsdata ocf:heartbeat:Filesystem params device=/dev/sdb1 directory=/var/lib/mfs fstype=ext4 op monitor interval=20s
添加组策略:group mfsgroup vip mfsdata mfsmaster
测试: