CentOS7 MFS 安装配置+说明

阅读更多
mini安装centos7

更新yum源
yum -y install net-tools wget lrzsz lsof
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
cd /etc/yum.repos.d/
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
yum clean all
yum makecache


安装依赖库
yum -y remove selinux*
yum -y update
yum -y install pcre pcre-devel openssl openssl-devel gcc-c++


安装MFS
vi /etc/hosts
172.16.33.230   mfs-master mfsmaster
172.16.33.231   metalogger
172.16.33.232   chunkserver01
172.16.33.234   chunkserver02
172.16.33.235   client-server


mfsmaster安装配置
hostnamectl set-hostname mfsmaster
mkdir -p /application
useradd mfs -M -s /sbin/nologin
systemctl disable iptables.service
cd /home/
wget https://fossies.org/linux/misc/legacy/moosefs-3.0.96-1.tar.gz
tar -zxvf moosefs-3.0.96-1.tar.gz
cd moosefs-3.0.96
./configure --prefix=/application/mfs --with-default-user=mfs --with-default-group=mfs
cd /application/mfs/etc/mfs
cp -a mfsmaster.cfg.sample mfsmaster.cfg
cp -a mfstopology.cfg.sample mfstopology.cfg
cp -a mfsexports.cfg.sample mfsexports.cfg
cd /application/mfs/var/mfs/
cp metadata.mfs.empty metadata.mfs
chown -R mfs:mfs /application/mfs/


vi /application/mfs/etc/mfs/mfsexports.cfg
172.16.0.0/16         /          rw,alldirs,maproot=0
*                       .          rw  

第一个设置,代表让172.16.0.0网段机器可以挂载mfs的根分区;如果将"/"改为"."符号则表示允许访问所有
第二个设置是允许客户端挂载使用回收站功能。如果决定了挂载mfsmeta,那么一定要在mfsmaster的mfsexport.cfg文件中添加这条记录:


配置mfsmaster自启
vi /lib/systemd/system/mfs.service
[Unit]
Description=mfs
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
ExecStart=/application/mfs/sbin/mfsmaster start
ExecReload=/application/mfs/sbin/mfsmaster reload
ExecStop=/application/mfs/sbin/mfsmaster stop
ExecRestart=/application/mfs/sbin/mfsmaster restart

[Install]
WantedBy=multi-user.target

systemctl start mfs.service
systemctl enable mfs.service
lsof -i :9420
COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
mfsmaster 4601  mfs    9u  IPv4  31114      0t0  TCP *:9420 (LISTEN)


配置cgi客户端
vi /lib/systemd/system/mfscgi.service
[Unit]
Description=mfscgi
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
ExecStart=/application/mfs/sbin/mfscgiserv start
ExecReload=/application/mfs/sbin/mfscgiserv reload
ExecStop=/application/mfs/sbin/mfscgiserv stop
ExecRestart=/application/mfs/sbin/mfscgiserv restart

[Install]
WantedBy=multi-user.target

systemctl start mfscgi.service
systemctl enable mfscgi.service
lsof -i :9425
COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
mfscgiser 1313 root    3u  IPv4  19739      0t0  TCP *:9425 (LISTEN)


安装mfschunkserver[其他chunkserver配置相同]
hostnamectl set-hostname chunkserver01
mkdir -p /application
useradd mfs -M -s /sbin/nologin
systemctl disable iptables.service
cd /home/
wget https://fossies.org/linux/misc/legacy/moosefs-3.0.96-1.tar.gz
tar -zxvf moosefs-3.0.96-1.tar.gz
cd moosefs-3.0.96
./configure --prefix=/application/mfs --with-default-user=mfs --with-default-group=mfs
cd /application/mfs/etc/mfs
cp -a mfsmaster.cfg.sample mfsmaster.cfg
cp -a mfstopology.cfg.sample mfstopology.cfg
cp -a mfsexports.cfg.sample mfsexports.cfg
cd /application/mfs/var/mfs/
cp metadata.mfs.empty metadata.mfs
chown -R mfs:mfs /application/mfs/

mkdir -p /data/mfsdata
chown -R mfs:mfs /data/mfsdata
cd /application/mfs/var/mfs/
cp metadata.mfs.empty metadata.mfs
cd /application/mfs/etc/mfs
cp mfschunkserver.cfg.sample mfschunkserver.cfg
vi mfschunkserver.cfg
MASTER_HOST = 172.16.33.230    //这个填写master管理节点的ip或主机名
MASTER_PORT = 9420

cp mfshdd.cfg.sample mfshdd.cfg
echo "/data/mfsdata 20G" >> mfshdd.cfg

设置chunkserver自启动
vi /lib/systemd/system/mfschunkserver.service
[Unit]
Description=mfschunkserver
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
ExecStart=/application/mfs/sbin/mfschunkserver start
ExecReload=/application/mfs/sbin/mfschunkserver reload
ExecStop=/application/mfs/sbin/mfschunkserver stop
ExecRestart=/application/mfs/sbin/mfschunkserver restart

[Install]
WantedBy=multi-user.target

systemctl start mfschunkserver.service
systemctl enable mfschunkserver.service
lsof -i :9422
COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
mfschunks 1239  mfs   11u  IPv4  18765      0t0  TCP *:9422 (LISTEN)


安装metalogger元数据日志服务器操作记录
hostnamectl set-hostname metalogger
mkdir -p /application
useradd mfs -M -s /sbin/nologin
systemctl disable iptables.service
cd /home/
wget https://fossies.org/linux/misc/legacy/moosefs-3.0.96-1.tar.gz
tar -zxvf moosefs-3.0.96-1.tar.gz
cd moosefs-3.0.96
./configure --prefix=/application/mfs --with-default-user=mfs --with-default-group=mfs
cd /application/mfs/var/mfs/
cp metadata.mfs.empty metadata.mfs
cd /application/mfs/etc/mfs
cp mfsmetalogger.cfg.sample mfsmetalogger.cfg
chown -R mfs:mfs /application/mfs

vi mfsmetalogger.cfg
META_DOWNLOAD_FREQ = 1              
MASTER_HOST = 172.16.33.230
MASTER_PORT = 9419


设置mfsmetalogger自启动
vi /lib/systemd/system/mfsmetalogger.service
[Unit]
Description=mfsmetalogger
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
ExecStart=/application/mfs/sbin/mfsmetalogger start
ExecReload=/application/mfs/sbin/mfsmetalogger reload
ExecStop=/application/mfs/sbin/mfsmetalogger stop
ExecRestart=/application/mfs/sbin/mfsmetalogger restart

[Install]
WantedBy=multi-user.target

systemctl start mfsmetalogger.service
systemctl enable mfsmetalogger.service
lsof -i :9419
COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
mfsmaster 4736  mfs    8u  IPv4  31683      0t0  TCP *:9419 (LISTEN)


安装mfs client客户端
mkdir -p /data/mfs /data/mfsmeta
yum -y install fuse fuse-devel
hostnamectl set-hostname client-server
mkdir -p /application
useradd mfs -M -s /sbin/nologin
systemctl disable iptables.service
cd /home/
wget https://fossies.org/linux/misc/legacy/moosefs-3.0.96-1.tar.gz
tar -zxvf moosefs-3.0.96-1.tar.gz
cd moosefs-3.0.96
 ./configure --prefix=/application/mfs --with-default-user=mfs --with-default-group=mfs --enable-mfsmount
make && make install
/application/mfs/bin/mfsmount /data/mfs -H mfsmaster
/application/mfs/bin/mfsmount /data/mfsmeta/ -H mfsmaster

查看mfscli信息
/application/mfs/bin/mfscli -SIN -H mfsmaster

df -h
文件系统                             容量  已用  可用 已用% 挂载点
mfsmaster:9421                     38G  128K   38G    1% /data/mfs




你可能感兴趣的:(centos)