[FastDFS]安装FastDFS

标签: fastdfs

其实很简单下面是源码包中INSTALL文件的内容

#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



安装nginx作为httpserver的时候需要安装fdfs的扩展,以下是安装步骤:

1、下载nginx源码包此处使用的是当前的stable版本nginx-1.10.1,另外还需要下载扩展的源码包,请自行去sourceforge搜索下载,本文使用的是v1.16,下载后解压;

2、很多人都在make nginx源码的时候遇到了以下报错:

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


因为通过上述fdfs的安装过程,需要重新配置下扩展的config文件中的路径不然是无法安装的。下面是config全部的内容,请根据自己当前的环境重新配置config文件:


./fastdfs-nginx-module/src/config

ngx_addon_name=ngx_http_fastdfs_module
HTTP_MODULES="$HTTP_MODULES ngx_http_fastdfs_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_fastdfs_module.c"
CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"
CORE_LIBS="$CORE_LIBS -L/usr/lib -lfastcommon -lfdfsclient"
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='256*1024' -DFDFS_MOD_CONF_FILENAME='\"/etc/fdfs/mod_fastdfs.conf\"'"
3、运行



ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so
ln -s /usr/lib64/libfastcommon.so /usr/lib/libfastcommon.so
ln -s /usr/lib64/libfdfsclient.so /usr/local/lib/libfdfsclient.so
ln -s /usr/lib64/libfdfsclient.so /usr/lib/libfdfsclient.so 


4、解压后切换到nginx源码目录执行:


./configure --prefix=/usr/include/nginx --with-threads --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_gzip_static_module --with-mail --with-stream --with-stream=dynamic --with-stream_ssl_module --add-module=/root/Downloads/fastdfs-nginx-module/src/
5、成功后直接执行make -j4 && make install 就可以了;


6、需要说明的一点,fdfs的配置文件中http端口都不一样请根据自己的需求配置nginx。


下面是本文引用的一些文章的网址:

[FastDFS] 编译Nginx的FastDFS模块fastdfs-nginx-module_v1.15出错

分布式存储 CentOS6.5虚拟机环境搭建FastDFS-5.0.5集群


版权所有:《Hoiwan's 》 => 《[FastDFS]安装FastDFS
本文地址:http://ihoiwan.com/?post=18
除非注明,文章均为 《Hoiwan's 》 原创,欢迎转载!转载请注明本文地址,谢谢。

发表评论: