FastDFS一键部署脚本
2020-07-14 06:04
134 查看
[code]#!/bin/bash #关闭防火墙 systemctl stop firewalld.service #安装编译环境 yum install -y git gcc gcc-c++ make automake autoconf libtool pcre pcre-devel zlib zlib-devel openssl-devel wget vim #创建数据存储目录 data_path=/data/dfs mkdir -p ${data_path} #下载包存放目录 cd /usr/local/src #安装libfatscommon git clone https://github.com/happyfish100/libfastcommon.git --depth 1 cd libfastcommon/ #编译安装 ./make.sh && ./make.sh install cd ../ #安装fastdfs git clone https://github.com/happyfish100/fastdfs.git --depth 1 cd fastdfs/ #编译安装 ./make.sh && ./make.sh install #配置文件准备 cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf #客户端文件 cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf #供nginx访问使用 cp /usr/local/src/fastdfs/conf/http.conf /etc/fdfs/ #供nginx访问使用 cp /usr/local/src/fastdfs/conf/mime.types /etc/fdfs/ cd ../ #安装fastdfs-nginx-module git clone https://github.com/happyfish100/fastdfs-nginx-module.git --depth 1 cp /usr/local/src/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs #安装nginx wget http://nginx.org/download/nginx-1.15.4.tar.gz #解压 tar -zxvf nginx-1.15.4.tar.gz cd nginx-1.15.4/ #添加fastdfs-nginx-module模块 ./configure --add-module=/usr/local/src/fastdfs-nginx-module/src/ #编译安装 make && make install #内网ip ip=`ip addr|grep inet|grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}'|grep -v 127.0.0.1|head -n 1` #tracker配置 sed -i 's#/home/yuqing/fastdfs#'$data_path'#g' /etc/fdfs/tracker.conf #storage配置 sed -i 's#/home/yuqing/fastdfs#'$data_path'#g' /etc/fdfs/storage.conf sed -i 's#192.168.209.121#'$ip'#g' /etc/fdfs/storage.conf sed -i 's#tracker_server = 192.168.209.122:22122#''#g' /etc/fdfs/storage.conf #配置client sed -i 's#/home/yuqing/fastdfs#'$data_path'#g' /etc/fdfs/client.conf sed -i 's#192.168.0.196#'$ip'#g' /etc/fdfs/client.conf sed -i 's#tracker_server = 192.168.0.197:22122#''#g' /etc/fdfs/client.conf #配置nginx访问 sed -i 's#base_path=/tmp#base_path='$data_path'#g' /etc/fdfs/mod_fastdfs.conf sed -i 's#tracker_server=tracker:22122#tracker_server='$ip':22122#g' /etc/fdfs/mod_fastdfs.conf sed -i 's#url_have_group_name = false#url_have_group_name = true#g' /etc/fdfs/mod_fastdfs.conf sed -i 's#store_path0=/home/yuqing/fastdfs#store_path0='$data_path'#g' /etc/fdfs/mod_fastdfs.conf echo '#user nobody; worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; keepalive_timeout 65; gzip on; server { listen 8888; server_name localhost; #access_log logs/host.access.log main; location ~/group[0-9]/ { ngx_fastdfs_module; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }' > /usr/local/nginx/conf/nginx.conf systemctl daemon-reload #启动tracker /etc/init.d/fdfs_trackerd start #启动storage /etc/init.d/fdfs_storaged start #启动nginx /usr/local/nginx/sbin/nginx #查看启动状态 ps -aux | grep fdfs_trackerd ps -aux | grep fdfs_storaged ps -aux | grep nginx
相关文章推荐
- shell脚本一键部署nginx
- dockerfile构建一键部署fastdfs+nginx 以及重定向
- zabbix-agent一键部署脚本
- FastDFS 自动部署和配置脚本
- jenkins结合脚本实现代码自动化部署及一键回滚至上一版本
- 一键部署lamp脚本记录
- 携程Apollo一键编译脚本+部署实现
- 使用Shell脚本一键部署Hadoop
- 源码编译安装Apache-附一键部署脚本
- Jstorm 集群搭建过程及一键安装部署脚本
- mysql5.7.25集群部署和方案设计(附PXC一键部署脚本)
- shell自动化一键部署脚本,秒级一键回滚脚本
- IDEA使用Alibaba Cloud Toolkit插件持续一键部署(附重启脚本)
- 简单的nginx一键部署脚本
- ceph集群一键部署脚本
- 持续集成之⑤:jenkins结合脚本实现代码自动化部署及一键回滚至上一版本
- Shell脚本一键部署MongoDB
- CentOS 6 apache源码编译一键部署脚本
- 一键部署ETCD集群脚本