Mfschunkserver Installation Scripts

Source: Internet
Author: User

#!/bin/bash


# # #结果判断

Judge () {

If [$?-eq 0];then

echo "Successfly ..."

Else

echo "Filed ..."

Exit 500

Fi

}


echo "# # #环境准备"

/etc/init.d/iptables Stop &>>/dev/null

Setenforce 0

Cd/usr/local/src

Yum-y Install Zlib-devel &>>/dev/null

ID MFS &>>/dev/null

If [$?-ne 0];then

Useradd-s/sbin/nologin MFS

Fi

Judge


echo "# # #下载mfs安装包"

if [! mfs-1.6.27-5.tar.gz];then

wget http://www.moosefs.org/tl_files/mfscode/mfs-1.6.27-5.tar.gz &>>/dev/null

Fi

Judge


echo "# # #编译安装"

TAR-ZXF mfs-1.6.27-5.tar.gz

CD mfs-1.6.27

./configure--prefix=/usr/local/mfs--with-default-user=mfs--with-default-group=mfs--disable-mfsmaster-- Disable-mfsmount &>> configure-' date +%f '. Log

Judge

Make &>> make-' date +%f '. Log

Judge

Make install &>> make-' date +%f '. Log

Judge

RM-RF make-' Date +%f '. Log configure-' date +%f '. Log


echo "# # #准备配置文件"

For i in ' ls/usr/local/mfs/etc/mfs/*.dist '

Do

Num= ' echo $i |wc-l '

Let num1= $num-5

File= ' echo ${i:0: $num 1} '

\CP $i $file

Done


Sed-i "/master_host/a\master_host = test_server_110_130"/usr/local/mfs/etc/mfs/mfschunkserver.cfg

Chown Mfs:mfs/usr/local/mfs/var/mfs

Judge


echo "# # #准备数据存储空间"

dev= ' Df-h | Grep/dev/sdb1|wc-l '

If [$dev-eq 0];then

if [!-d/cache1];then

Mkdir/cache1

Mount/dev/sdb1/cache1

Name= ' Df-h|awk ' $0~/dev\/sdb1/{print $NF} '

Else

Mount/dev/sdb1/cache1

Name= ' Df-h|awk ' $0~/dev\/sdb1/{print $NF} '

Fi

Else

Name= ' Df-h|awk ' $0~/dev\/sdb1/{print $NF} '

Fi

Chown-r Mfs:mfs $name

echo "$name" >>/usr/local/mfs/etc/mfs/mfshdd.cfg

Judge


echo "# # #准备chunkserver启动脚本"

\cp/usr/local/mfs/sbin/mfschunkserver/etc/init.d/mfschunkserver

chmod +x/etc/init.d/mfschunkserver

Judge


echo "# # #添加开机启动项和hosts"

Sed-i '/mfs/d '/etc/rc.local

Sed-i '/test_server/d '/etc/hosts

Sed-i "/MOUNT/D"/etc/rc.local

Echo-e "/etc/init.d/mfschunkserver start\nmount/dev/sdb1/cache1/" >>/etc/rc.local

echo "192.168.110.130 test_server_110_130

192.168.110.131 test_server_110_131

192.168.110.132 test_server_110_132

192.168.110.133 test_server_110_133

192.168.110.134 test_server_110_134 ">>/etc/hosts

/etc/init.d/mfschunkserver start

Judge


Mfschunkserver Installation Scripts

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.