分布式文件系统FastDFS部署(2)

1.nginx安装,可以使用源码编译,源码编译请移步这篇 ,在编译安装时添加 --add-module=/root/fastdfs-nginx-module/src/

2.配置

# wget

# tar xf download.1

3.解决报错

make的时候会报一下错误,

root/fastdfs-nginx-module/src//common.c:21:25: fatal error: fdfs_define.h: No such file or directory

#include "fdfs_define.h"

^

compilation terminated.

make[1]: *** [objs/addon/src/ngx_http_fastdfs_module.o] Error 1

解决办法:

vim /root/fastdfs-nginx-module/src/config

CORE_INCS="$CORE_INCS /usr/local/include/fastdfs /usr/local/include/fastcommon/"

CORE_LIBS="$CORE_LIBS -L/usr/lib -lfastcommon -lfdfsclient"

重新编译,安装即可

4.配置

# cp /root/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/.

# cp /root/FastDFS/conf/http.conf /etc/fdfs/.

/root/FastDFS/conf/mime.types /etc/fdfs/.

修改nginx的配置文件

server {

listen      18888;

server_name  localhost;

location  ~/group1/M00 {

root /fdfs/storage/data;

ngx_fastdfs_module;

}

error_page  500 502 503 504  /50x.html;

location = /50x.html {

root  /usr/share/nginx/html;

}

}


    6.启动nginx

八、在tracker安装nginx

在tracker上安装的nginx主要为了提供http访问的反向代理、负载均衡已经缓存服务


    1.安装配置与storage上相同

2.配置负载功能

upstream fdfs_group3 {

server 172.16.1.207:8080 weight=1 max_fails=2 fail_timeout=30s;

server 172.16.1.208:8080 weight=1 max_fails=2 fail_timeout=30s;

}

server {

#

设置服务器端口

listen      8080;

#

设置

group1

的负载均衡参数

location /group1/M00 {

proxy_next_upstream http_502 http_504 error timeout invalid_header;

proxy_cache http-cache;

proxy_cache_valid  200 304 12h;

proxy_cache_key $uri$is_args$args;

proxy_pass ;

expires 30d;

九。测试

cd /etc/fdfs/

cp client.conf.sample client.conf

base_path=/data/fdfs/tracker                    #

日志存放路径

tracker_server=172.16.8.8:22122          #tracker

服务器

IP

地址和端口号

http.tracker_server_port=8080              #tracker

服务器的

http

端口号

上传文件

/usr/bin/fdfs_upload_file /etc/fdfs/client.conf /root/install3.sh

group1/M00/00/00/rBAIClZB6ySAYFbtAAAGpOjLUVA6601.sh

日志报错

[2015-11-10 21:04:04] ERROR - file: ../common/fdfs_global.c, line: 52, the format of filename "group1/M00/00/00/rBAIClZB6ySAYFbtAAAGpOjLUVA6601.sh" is invalid

vi /etc/fdfs/mod_fastdfs.conf

url_have_group_name = true

再次测试上传

[root@vrvap2 fdfs]# /usr/bin/fdfs_upload_file /etc/fdfs/client.conf /root/new.jpg

group1/M00/00/00/rBAIClZB7fWAF2BmAADCkWSm8AA128.jpg

分布式文件系统FastDFS部署

测试成功,终于完成了

CentOS 6.2下fastDFS的完整安装和配置步骤

FastDFS在Ubuntu下的安装,PHP客户端

FastDFS分布式文件服务器安装,及配置,测试

FastDFS 整合Nginx问题整理

CentOS下搭建FastDFS

Ubuntu安装FastDFS全程记录

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/a8494137429ca403b4205c719dadafae.html