Centos7.2 FastDFS_V5.05 集群的安装与配置
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos7.2 FastDFS_V5.05 集群的安装与配置相关的知识,希望对你有一定的参考价值。
环境: Centos 7.2/64位 两台服务器 都为tracker 和 storage
10.100.0.1 storage tracker
10.100.0.2 storage tracker
1 和 2安装配置类似, 下面以一台为例
1, 安装依赖包,添加fastDFS运行用户
yum install -y zlib zlib-devel pcre pcre-devel gcc gcc-c++ openssl openssl-devel libevent libevent-devel perl unzip
useradd -s /sbin/nologin fastdfs
2,创建数据存储目录
mkdir -p /export/fastdfs/{storage,tracker}
[[email protected] src]# ll /export/fastdfs
total 0
drwxr-xr-x 2 root root 6 Dec 10 15:18 storage #Storage目录保存运行日志及其data数据
drwxr-xr-x 2 root root 6 Dec 10 15:17 tracker #tracker目录保存运行日志
3,安装libfastcommon
下载最新版本: libfastcommon
wget https://github.com/happyfish100/libfastcommon/archive/master.zip
unzip master.zip
cd libfastcommon-master/
./make.sh
./make.sh install
4, 安装Fastdfs
wget http://sourceforge.net/projects/fastdfs/files/FastDFS%20Server%20Source%20Code/FastDFS%20Server%20with%20php%20Extension%20Source%20Code%20V5.05/FastDFS_v5.05.tar.gz/download
tar zxf FastDFS_v5.05.tar.gz && cd FastDFS
./make.sh
./make.sh install
chown -R fastdfs: /export/fastdfs
5, 配置tracker 和 storage 配置文件, 对应修改(配置文件的路径:/etc/fdfs/)
vi storage.conf
group_name=group1
base_path=/export/fastdfs/storage
store_path0=/export/fastdfs/storage
tracker_server=192.168.0.205:22122
tracker_server=192.168.0.206:22122
http.server_port=80
vi tracker.conf base_path=/export/fastdfs/tracker
vi client.conf tracker_server=192.168.0.205:22122 tracker_server=192.168.0.206:22122
6.安装fastdfs-nginx-module模块
cd /usr/local
wget http://sourceforge.net/projects/fastdfs/files/FastDFS%20Nginx%20Module%20Source%20Code/fastdfs-nginx-module_v1.16.tar.gz/download
tar zxf fastdfs-nginx-module_v1.16.tar.gz
cd fastdfs-nginx-module/src
vi conf #更改如下, 去掉local,并指定lib64(64系统)
CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"
CORE_LIBS="$CORE_LIBS -L/usr/lib64 -lfastcommon -lfdfsclient"
vi mod_fastdfs.conf group_name=group1 base_path=/export/fastdfs/storage store_path0=/export/fastdfs/storage tracker_server=192.168.0.205:22122 tracker_server=192.168.0.206:22122 url_have_group_name = true #是true 不是ture
并且该文件修改完成以后复制到/etc/fdfs/目录
7.安装Nginx
wget http://nginx.org/download/nginx-1.8.0.tar.gz
tar zxf nginx-1.8.0.tar.gz
useradd -s /sbin/nologin www
cd nginx-1.8.0
/configure --user=www --group=www --add-module=/usr/local
/fastdfs-nginx-module/src/ --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module
make
make install
8.配置Nginx
server {
listen 80;
server_name 192.168.0.205;
root /webdata/fastdfs.com;
index index.html index.htm;
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.html last;
}
location /group1/M00 {
root /export/fastdfs/storage/data/;
ngx_fastdfs_module;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js)$ {
# fastcgi_cache cache_one; #nginx.conf 开启cache才行,要不然启动报错
fastcgi_cache_valid 200 10m;
fastcgi_cache_valid 304 3m;
fastcgi_cache_valid 301 302 1h;
fastcgi_cache_valid any 1m;
fastcgi_cache_min_uses 1;
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_cache_key $host$request_uri;
access_log off;
}
}
access_log off;
}
以上是关于Centos7.2 FastDFS_V5.05 集群的安装与配置的主要内容,如果未能解决你的问题,请参考以下文章