fastdfs部署指南

原创
2018/02/27 12:31
阅读数 321

前言:网上大多数的fastdfs部署教程都是过时的老帖,我根据最新版本部署安装。 作者的主页 https://github.com/happyfish100。看这篇教程之前,最好对linux系统基本操作较为熟悉。

正文: 第一步,安装libfastcommon 从官网下载最新的发型版本 https://github.com/happyfish100/libfastcommon/releases,安装步骤如下 #step 1. download libfastcommon source package and unpack it, tar xzf libfastcommon_v1.x.tar.gz #for example: tar xzf libfastcommon_v1.36.tar.gz

#step 2. enter the libfastcommon dir cd libfastcommon

#step 3. make ./make.sh

#step 4. make install ./make.sh install 第二步,安装 fastdfs #step 1. download libfastcommon source package from github and install it, the github address: https://github.com/happyfish100/libfastcommon.git

#step 2. download FastDFS source package and unpack it, tar xzf FastDFS_v5.x.tar.gz #for example: tar xzf FastDFS_v5.08.tar.gz

#step 3. enter the FastDFS dir cd FastDFS

#step 4. execute: ./make.sh

#step 5. make install ./make.sh install

#step 6. edit/modify the config file of tracker and storage

#step 7. run server programs #start the tracker server: /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart #in Linux, you can start fdfs_trackerd as a service: /sbin/service fdfs_trackerd start

#start the storage server: /usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart #in Linux, you can start fdfs_storaged as a service: /sbin/service fdfs_storaged start

#step 8. run test program #run the client test program: /usr/bin/fdfs_test <client_conf_filename> <operation> /usr/bin/fdfs_test1 <client_conf_filename> <operation> #for example, upload a file: /usr/bin/fdfs_test conf/client.conf upload /usr/include/stdlib.h

#step 9. run monitor program #run the monitor program: /usr/bin/fdfs_monitor <client_conf_filename>

tracker server config file sample please see conf/tracker.conf

storage server config file sample please see conf/storage.conf

client config file sample please see conf/client.conf

第三步,安装 fastdfs #step 1. first install the FastDFS storage server and client library, the FastDFS version should >= 5.11. download address: https://github.com/happyfish100/fastdfs

#step 2. install nginx server FastDFS nginx module test passed with nginx 1.8.1, my nginx installed in /usr/local/nginx

#step 3. download FastDFS nginx module source package and unpack it, such as: tar xzf fastdfs_nginx_module_v1.20.tar.gz

#step 4. enter the nginx source dir, compile and install the module, such as: cd nginx-1.8.1 ./configure --add-module=/home/yuqing/fastdfs-nginx-module/src make; make install

Notice: before compile, you can change FDFS_OUTPUT_CHUNK_SIZE and FDFS_MOD_CONF_FILENAME macro in the config file as: CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='256*1024' -DFDFS_MOD_CONF_FILENAME='"/etc/fdfs/mod_fastdfs.conf"'"

#step 5. config the nginx config file such as nginx.conf, add the following lines:

    location /M00 {
        root /home/yuqing/fastdfs/data;
        ngx_fastdfs_module;
    }

#step 6. make a symbol link ${fastdfs_base_path}/data/M00 to ${fastdfs_base_path}/data, command line such as: ln -s /home/yuqing/fastdfs/data /home/yuqing/fastdfs/data/M00

#step 7. change the config file /etc/fdfs/mod_fastdfs.conf, more detail please see it

#step 8. restart the nginx server, such as: /usr/local/nginx/sbin/nginx -s stop; /usr/local/nginx/sbin/nginx

备注: 对官方方法的修改和补充

更改 #step 5. config the nginx config file such as nginx.conf, add the following lines:

    location  {
        root /home/yuqing/fastdfs/data;
        ngx_fastdfs_module;
    }

去除 #step 6. make a symbol link ${fastdfs_base_path}/data/M00 to ${fastdfs_base_path}/data, command line such as: ln -s /home/yuqing/fastdfs/data /home/yuqing/fastdfs/data/M00

.配置mod_fastdfs.conf cp /root/fdfs/fastdfs-nginx-module-master/src/mod_fastdfs.conf /etc/fdfs/ mkdir /data/ngx vi /etc/fdfs/mod_fastdfs.conf

修改下面四个参数:

the base path to store log files

base_path=/data/ngx

FastDFS tracker_server

tracker_server=192.168.153.130:22122

store_path#, based 0, if store_path0 not exists, it's value is base_path

the paths must be exist

must same as storage.conf

store_path0=/data/fdfs/storage

if the url / uri including the group name

url_have_group_name = true

添加http.conf,mime.types到/etc/fdfs cd /root/fdfs/fastdfs-5.05/conf cp http.conf mime.types /etc/fdfs

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
0 评论
0 收藏
0
分享
返回顶部
顶部