Ubuntu FastDFSv5.05+Nginx1.9.15 环境搭建

#FastDFS安装实践

环境简介

  • Ubuntu 12.04
  • 单台机器测试

安装步骤

可以参照 http://dorole.com/1365/

1.安装FastDFS基础服务(Tracker, Storage节点都需要安装)

1)安装libfastcommon
git clone https://github.com/happyfish100/libfastcommon.git
cd libfastcommon/
./make.sh
./make.sh install
设置环境变量
export LD_LIBRARY_PATH=/usr/lib64/
ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so
2)安装FastDFS基础服务
wget http://iweb.dl.sourceforge.net/project/fastdfs/FastDFS%20Server%20Source%20Code/FastDFS%20Server%20with%20PHP%20Extension%20Source%20Code%20V5.05/FastDFS_v5.05.tar.gz
tar xzf FastDFS_v5.05.tar.gz
cd FastDFS
./make.sh
./make.sh install
确认make没有错误后,执行安装,默认会安装到/usr/bin中,并在/etc/fdfs中添加三个配置文件。

2.在Storage节点上安装nginx+fastdfs-nginx-module

可以参照 http://blog.csdn.net/zht666/article/details/17137205
nginx用于提供http访问存储的资源,fastdfs-nginx-module用于解决同一个group下资源同步延迟问题,可以将http的访问转发到一开始存储的节点上。
1)安装nginx依赖库
zlib
wget http://zlib.net/zlib-1.2.8.tar.gz
tar xzf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure --prefix=/usr/local/zlib-1.2.8 && make &&make install
pcre
wget http://exim.mirror.fr/pcre/pcre-8.38.tar.gz
tar xzf pcre-8.38.tar.gz
cd pcre-8.38
./configure --prefix=/usr/local/pcre-8.33 --libdir=/usr/local/lib/pcre --includedir=/usr/local/include/pcre && make && make install
openssl
wget http://www.openssl.org/source/openssl-1.0.1e.tar.gz
tar xzf openssl-1.0.1e.tar.gz
cd openssl-1.0.1e
./config --prefix=/usr/local/openssl-1.0.1e -fPIC && make && make install
2)安装ngnix
wget http://jaist.dl.sourceforge.net/project/fastdfs/FastDFS%20Nginx%20Module%20Source%20Code/fastdfs-nginx-module_v1.16.tar.gz
tar xzf fastdfs-nginx-module_v1.16.tar.gz
设置fastdfs-nginx-module使用的lib路径
cd fastdfs-nginx-module/src
vi config
修改CORE_LIBS为(去掉local,并将lib->lib64)
CORE_INCS=” COREINCS/usr/include/fastdfs/usr/include/fastcommon/CORELIBS= CORE_LIBS -L/usr/lib64 -lfastcommon -lfdfsclient”
为了nginx自启动还需要
ln -s /usr/lib64/libfdfsclient.so /usr/lib/libfdfsclient.so
下载并安装nginx
wget http://nginx.org/download/nginx-1.9.15.tar.gz
tar xzf nginx-1.9.15.tar.gz
cd nginx-1.9.15
./configure --prefix=/usr/local/nginx --with-pcre=/root/software/pcre-8.38 --with-zlib=/root/software/zlib-1.2.8 --add-module=/root/software/fastdfs-nginx-module/src --with-http_ssl_module --with-openssl=/root/software/openssl-1.0.1e --sbin-path=/usr/local/nginx/sbin/nginx && make && make install
3)拷贝配置文件至/etc/fdfs/
cp FastDFS/conf/http.conf /etc/fdfs/
cp FastDFS/conf/mime.types /etc/fdfs/
cp FastDFS/conf/anti-steal.jpg /etc/fdfs/
cp fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/
cd /etc/fdfs
mv storage.conf.sample storage.conf
mv tracker.conf.sample tracker.conf
mv client.conf.sample client.conf

3.修改配置文件

1) tracker.conf说明 http://www.tuicool.com/articles/RjQf22f
2) storage.conf说明 http://www.tuicool.com/articles/fuMJjyf
3) mod_fastdfs.conf 该文件中的配置决定了nginx的URL指向具体的文件位置
4) /usr/local/nginx/conf/nginx.conf 配置一个新的location

4.fastdfs java api开发说明

http://blog.sina.com.cn/s/blog_69357fbb0100r5c3.html

5.配置文件实践

mkdir -p /usr/fastdfs/tracker
mkdir -p /usr/fastdfs/storage
mkdir -p /usr/fastdfs/storage0
mkdir -p /usr/fastdfs/client
mkdir -p /home/lmzhou/fastdfs-test-log

  • tracker.conf
    base_path=/usr/fastdfs/tracker

  • storage.conf
    base_path=/usr/fastdfs/storage
    store_path0=/usr/fastdfs/storage0
    #注意下面的ip是外网IP
    tracker_server=120.27.26.94:22122
    #下面的端口与nginx的listen端口一致
    http.server_port=8888

  • mod_fastdfs.conf
    base_path=/usr/fastdfs/client
    tracker_server=10.45.228.80:22122
    url_have_group_name = true
    store_path0=/usr/fastdfs/storage0

  • /usr/local/nginx/conf/nginx.conf
    listen 8888;
    location /group1/M00 {
    root /usr/fastdfs/storage0/data;
    ngx_fastdfs_module;
    }

-client.conf
base_path=/home/lmzhou/fastdfs-test-log
/home/lmzhou/fastdfs-test-log 要提前创建,用于使用fdfs_test测试上传
tracker_server=120.27.26.94:22122

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值