一、安装

1.centos环境配置

yum update -y
yum install -y epel-release
yum install -y vim net-tools nmon clamav htop rsync iptraf-ng tree lrzsz cmake make gcc gcc-c++ ntp iftop telnet tcpdump traceroute

2.设置时间同步

echo "0 8 * * * root ntpdate ntp.southbaytech.co" >> /etc/crontab

3.关闭selinux和开启防火墙端口

sed -i 's@SELINUX=enforcing@SELINUX=disabled@' /etc/selinux/config
firewall-cmd --add-port=9422/tcp
firewall-cmd --add-port=9422/tcp --permanent

4.禁用DNS反向解析

sed -i 's@GSSAPIAuthentication yes@GSSAPIAuthentication no@' /etc/ssh/sshd_config
sed -i 's@#UseDNS yes@UseDNS no@' /etc/ssh/sshd_config

5.安装moosefs软件

curl "http://ppa.moosefs.com/RPM-GPG-KEY-MooseFS" > /etc/pki/rpm-gpg/RPM-GPG-KEY-MooseFS
curl "http://ppa.moosefs.com/MooseFS-3-el7.repo" > /etc/yum.repos.d/MooseFS.repo
yum install moosefs-chunkserver  moosefs-client -y

二、配置硬盘挂载(以sdb为例)

1.查看服务器硬盘信息

fdisk -l

2.硬盘sdb分区格式化并挂载

parted /dev/sdb
mklabel gpt
mkpart primary 0% 100%
q
mkfs.xfs -f /dev/sdb1

3.设置开机自动挂载

mkdir /mnt/moosefs_0
mount /dev/sdb1 /mnt/moosefs_0
vim /etc/fstab
/dev/sdb1 /mnt/moosefs_0       xfs     defaults        0 0

三、配置moosefs

1.配置chunkserver中的mfshdd

vim /etc/mfs/mfshdd.cfg
/mnt/moosefs_0 -10GiB

2.配置chunkserver中的mfschunkserver

sed -i 's\# MASTER_HOST = mfsmaster\MASTER_HOST = mfsmaster20.southbaytech.co\' /etc/mfs/mfschunkserver.cfg

3.设置开机启动

# Master
systemctl enable moosefs-master
systemctl enable moosefs-cgiserv
# Chunkserver
systemctl enable moosefs-chunkserver
# Metalogger
systemctl enable moosefs-metalogger

4.启动chunkserver服务

mfschunkserver start
# 出现无法创建lock,继续执行
chown -R mfs:mfs /mnt/*
mfschunkserver start

5.设置系统读写性能

sed -i '$a\vm.dirty_background_ratio = 5' /etc/sysctl.conf
sed -i '$a\vm.dirty_ratio = 20' /etc/sysctl.conf