码迷,mamicode.com
首页 > 其他好文 > 详细

FastDFS 自动部署和配置脚本

时间:2015-04-01 19:41:29      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:

写了一个自动安装和配置FastDFS的脚本,还没有写好关于nginx的配置。先贴上,如下:

自动安装FastDFS,(这部分是之前同事写好的)

#!/bin/bash

#instll gcc
echo "==================    install gcc    =================="

cd ./gccRpm
./gccInstall.sh
cd ..

echo "==================    gcc installed  =================="

#install depended Packages
echo "==================  install depends  =================="

rpm -ivh libevent-1.4.13-4.el6.x86_64.rpm

echo "================== depends installed =================="

#install fastdfs
echo "==================  install fastdfs  =================="

tar -zxvf fdfsinstall.tar.gz
cd FastDFS
./make.sh
./make.sh install
cd ../

echo "================= fastdfs installed  =================="
echo "================= install nginx  =================="
tar -zxvf nginx-1.6.2.tar.gz
tar -zxvf fastdfs-nginx-module_v1.15.tar.gz

cd nginx-1.6.2
./configure  --prefix=/usr/local/nginx --add-module=../fastdfs-nginx-module/src  --without-http_gzip_module
make
make install
cp ../fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/
cd ..
echo "================= fastdfs config ==================="
./config.sh $1 $2 $3

config.sh脚本主要用来自动配置tracker和storage

#!/bin/bash
role=$1
path=/home/fastdfs/$role

sed -i s/\(disabled=\)\S\S*/\1false/ /etc/fdfs/$role.conf
sed -i "s:\(base_path=\)\S\S*:\1${path}:"  /etc/fdfs/$role.conf
sed -i s/\(port=\)\S\S*/\122122/ /etc/fdfs/$role.conf
sed -i s/\(http.server_port=\)\S\S*/\18080/ /etc/fdfs/$role.conf
if [[ $role == "storage" ]]; then
        sed -i "s:\(group_name=\)\S\S*:\1group${2}:"  /etc/fdfs/$role.conf
        sed -i "s#\(tracker_server=\)\S\S*#\1${3}:22122#" /etc/fdfs/$role.conf
        sed -i "s:\(store_path0=\)\S\S*:\1${path}:" /etc/fdfs/$role.conf
        sed -i "s:\(store_path_count\)\S\S*:\11:" /etc/fdfs/$role.conf
fi

FastDFS 自动部署和配置脚本

标签:

原文地址:http://www.cnblogs.com/dorothychai/p/4384658.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!