fastdfs笔记

一. 安装fastdfs

fastdfs官网:http://code.google.com/p/fastdfs/downloads/list

 

yum install gcc

 github版本列表地址:http://sourceforge.net/projects/levent/files/libevent/

最新稳定版是:http://nchc.dl.sourceforge.net/project/levent/libevent/libevent-2.0/libevent-2.0.21-stable.tar.gz

wget http://nchc.dl.sourceforge.net/project/levent/libevent/libevent-2.0/libevent-2.0.21-stable.tar.gz
    tar xvzf libevent-2.0.20-stable.tar.gz 
    ./configure 
    make 
    make install 
     
    将库文件链接到/lib64 
    ln -s /usr/local/lib/libevent-2.0.so.5 /lib64/libevent-2.0.so.5 

 

 

 目前最新是:http://fastdfs.googlecode.com/files/FastDFS_v4.06.tar.gz

wget http://fastdfs.googlecode.com/files/FastDFS_v3.11.tar.gz 
    tar xvzf FastDFS_v3.11.tar.gz 
     
    修改 make.sh 
    #WITH_HTTPD --> WITH_HTTPD 
     
    ./make.sh 
    ./make.sh install 

 

二. 配置 ,启动

1. tracker

vim /etc/fdfs/tracker.conf 

base_path=/home/yuqing/fastdfs -> base_path=/opt/fastdfs 

##include http.conf -> #include http.conf

 

启动:/usr/local/bin/fdfs_trackerd  /etc/fdfs/tracker.conf

 

重启:/usr/local/bin/restart.sh  /usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf 

 

2. 数据节点

vim /etc/fdfs/storage.conf 
base_path=/home/yuqing/fastdfs --> /opt/fastdfs 
store_path0=/home/yuqing/fastdfs --> store_path0=/opt/fastdfs 
group_name=group1 
tracker_server=192.168.209.121:22122 --> tracker_server=192.168.0.10:22122 
##include http.conf --> #include http.conf 

 

/usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf 

 

3. 客户端

vim /etc/fdfs/client.conf 
vi /etc/fdfs/client.conf 
base_path=/home/yuqing/fastdfs-> base_path=/opt/fastdfs 
tracker_server=192.168.209.121:22122 -> tracker_server=192.168.0.10:22122 
##include http.conf ->#include http.conf 

 

/usr/local/bin/fdfs_test /etc/fdfs/client.conf upload FastDFS_v3.03.tar.gz 

 

4. 防火墙配置

vi /etc/sysconfig/iptables

iptables -A INPUT -p tcp --dport 22122 -j ACCEPT

 service iptables restart

 

三. nginx配置到数据节点

1. 下载nginx和fastdfs-nginx-module

http://fastdfs-nginx-module.googlecode.com/files/fastdfs-nginx-module_v1.09.tar.gz (高版本的编译不过)

安装依赖库

yum install gcc

yum install readline-devel pcre-devel openssl-devel

编译安装nginx及fastdfs模块

./configure --prefix=/usr/local/nginx --add-module=/root/tmp/fastdfs-nginx-module/src

make

make install

 

2. fastdfs数据节点的http服务要关闭 vi /etc/fdfs/storage.conf

# 关闭内置的web server
 http.disabled=true
 
 # the port of the web server on this storage server
 # web server的端口改成80

 

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

vi /etc/fdfs/mod_fastdfs.conf

基本配置省略

url_have_group_name = true

 

3 . nginx配置

vi /usr/local/nginx/conf/nginx.conf
    location /group1/M00 {
            root /home/storage1/fastdfs/data;
            ngx_fastdfs_module;
    }

 

ln -s /home/storage1/fastdfs/data  /home/storage1/fastdfs/data/M00

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值